How can I reduce PageControl flicker in Delphi?

后端 未结 2 714
礼貌的吻别
礼貌的吻别 2021-01-02 13:44

In Delphi 2009 I found that the flicker of a PageControl - which occurs during resizing of the form - can be reduced by setting its DoubleBuffered property to t

2条回答
  •  醉话见心
    2021-01-02 14:26

    This is far from perfect, but you might want to use this:

      protected
        procedure WMExitSize(var Message: TMessage); message WM_EXITSIZEMOVE;
        procedure WMEnterSize(var Message: TMessage); message WM_ENTERSIZEMOVE;
    

    procedure TFormMain.WMEnterSize(var Message: TMessage);
    begin
      if Assigned(PageControlView.ActivePage) then
        PageControlView.Align := alNone;
    end;
    
    procedure TFormMain.WMExitSize(var Message: TMessage);
    begin
      if Assigned(PageControlView.ActivePage) then
        PageControlView.Align := alClient;
    end;
    

    It's the best I found this far, and will reduce the windows update of your page control. It might be less pretty, though, but that's a matter of opinions...

提交回复
热议问题