Mithilfe der JCL kann man das auch ohne Einbinden der
Unit an korrekter Position bewerkstelligen:
Delphi-Quellcode:
uses
JclSysUtils;
type
TListBoxFix = class(TCustomListBox)
public
procedure CreateParamsFix(var Params: TCreateParams);
end;
procedure TListBoxFix.CreateParamsFix(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_COMPOSITED;
end;
procedure PatchVirtualMethod(AClass: TClass; OldMethod, NewMethod: Pointer);
var
i: Integer;
begin
for i := 0 to GetVirtualMethodCount(AClass) do
if GetVirtualMethod(AClass, i) = OldMethod then
SetVirtualMethod(AClass, i, NewMethod);
end;
initialization
PatchVirtualMethod(TListBox, @TListBoxFix.CreateParams, @TListBoxFix.CreateParamsFix);
PatchVirtualMethod(TcxInnerListBox, @TListBoxFix.CreateParams, @TListBoxFix.CreateParamsFix);