Einzelnen Beitrag anzeigen

Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.009 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#2

AW: [DevExpress-HowTo] TcxListBox / TListBox flickerfrei

  Alt 14. Mär 2012, 13:50
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);
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat