Problem with Delphi TSplitter

I am using Delphi with VCL styles enabled, and I would like to change the color of TSplitter for my form. I override TSplitter.Paintin the interpolator class to draw a darker color than the default color of the VCL styles cBtnFace, but when the size is changed, the form flickers significantly. Is there any way to remove this flicker?

I tried these things to try to reduce flicker, but no one worked:

  • Disabling VCL ( TSplitter.StyleElements := []) styles .

  • Changing the style of the object constructor of the VCL bit style element designer for "Splitter", but changing this element of the object does not change the appearance of the separator.

  • Trying to process a message WM_ERASEBKGNDon objects TControl, but I was unable to get this procedure to call interposer in my class.

    procedure WMEraseBkgnd(var Msg: TWMEraseBkgnd); message WM_ERASEBKGND;
    ...
    procedure TSplitter.WMEraseBkgnd(var Msg: TWMEraseBkgnd);
    begin
        // this is never invoked by the TSplitter
        Msg.Result := 1;
    end;
    

TSplitter? DoubleBuffer TSplitter - , .

UPDATE

, , , , TSplitter :

TForm (DoubleBuffered = False)
-> BackgroundPanel (DoubleBuffered = True, ParentBackground = False)
-> -> A TGradient, image and label to fill the BackgroundPanel
-> LeftPanel (ParentBackground = False`, no flickering)
-> -> LeftPanelFrame and frame content (selective double buffering)
-> TSplitter
-> RightPanel (ParentBackground = False, no flickering)
-> -> RightPanelFrame and frame content (selective double buffering)

, alClient ( OnResized ).

, BackgroundPanel LeftPanel, TSplitter RightPanel (.. Control → Send to Back), DoubleBuffered = True ParentBackground = False BackgroundPanel / UI (.. TSplitter). , , .

, TPanel LeftPanel, TSplitter RightPanel DoubleBuffered = True ParentBackground = False. . , :

TForm
-> BackgroundPanel (DoubleBuffered = True, ParentBackground = False)
-> -> A TGradient, image and label to fill the BackgroundPanel
-> EncapsulatingPanel (DoubleBuffered = True, ParentBackground = False)
-> -> LeftPanel (ParentBackground = False)
-> -> -> LeftPanelFrame and frame content
-> -> TSplitter
-> -> RightPanel (ParentBackground = False)
-> -> -> RightPanelFrame and frame content

, , TForm ( ), , .

2

, ( TPanel) TSplitter, , , @David Heffernan . , 1 + .

+5
1

TSplitter DoubleBuffered, , - - . ParentDoubleBuffered , .

DoubleBuffered , . DoubleBuffered , . , . , DoubleBuffered . , ( ).

- , , , (, , , , ...). ( ).

+3

All Articles