@@ -88,7 +88,24 @@ TStyleManagerStyleNamesAccess = class(TContainerAccess)
8888implementation
8989
9090uses
91- System.SysUtils, Vcl.Controls, MethodCallBack;
91+ System.SysUtils, System.Rtti, Vcl.Controls, Vcl.StdCtrls, Vcl.Forms, MethodCallBack;
92+
93+ type
94+ // https://github.com/Embarcadero/DelphiVCL4Python/issues/18
95+ TMemoStyleHookWA18 = class (TMemoStyleHook)
96+ strict private
97+ FParent: TScrollingStyleHook;
98+ strict protected
99+ procedure WndProc (var Message: TMessage); override;
100+ public
101+ constructor Create(AControl: TWinControl); override;
102+ destructor Destroy; override;
103+ end ;
104+
105+ TScrollingStyleHookCrackerWA18 = class (TScrollingStyleHook)
106+ protected
107+ procedure WndProc (var Message: TMessage); override;
108+ end ;
92109
93110{ Global Functions }
94111
@@ -510,7 +527,43 @@ class procedure TPyDelphiCustomStyleServices.RegisterMethods(
510527 inherited ;
511528end ;
512529
530+ { TMemoStyleHookWA18 }
531+
532+ constructor TMemoStyleHookWA18.Create(AControl: TWinControl);
533+ begin
534+ inherited ;
535+ FParent := TScrollingStyleHook.Create(AControl);
536+ end ;
537+
538+ destructor TMemoStyleHookWA18.Destroy;
539+ begin
540+ FParent.Free();
541+ inherited ;
542+ end ;
543+
544+ procedure TMemoStyleHookWA18.WndProc (var Message: TMessage);
545+ begin
546+ case Message.Msg of
547+ WM_ERASEBKGND:
548+ begin
549+ TScrollingStyleHookCrackerWA18(FParent).WndProc(Message);
550+ end ;
551+ else inherited ;
552+ end ;
553+ end ;
554+
555+ { TScrollingStyleHookCrackWA18 }
556+
557+ procedure TScrollingStyleHookCrackerWA18.WndProc (var Message: TMessage);
558+ begin
559+ inherited ;
560+ end ;
561+
513562initialization
514563 RegisteredUnits.Add(TVclThemesRegistration.Create());
564+ TCustomStyleEngine.RegisterStyleHook(TMemo, TMemoStyleHookWA18);
565+
566+ finalization
567+ TCustomStyleEngine.UnRegisterStyleHook(TMemo, TMemoStyleHookWA18);
515568
516569end .
0 commit comments