8

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 true.

However if I add controls to the PageControl tabsheets, they will flicker regardless of their DoubleBuffered property setting. I have also tried with and without runtime themes enabled.

mjn
  • 36,362
  • 28
  • 176
  • 378
  • 1
    Yes, using resizable page controls is painful. In most cases, in my experience, setting the double buffered property of every control (page control and every child control) to true fixes most of the problem, but in some cases, will *cause* other rendering issues, for some child controls. Since I am very concerned about visual quality, I tend to 1) enable double buffering on resize, and use a timer to disable it 1/5 of a second after the last resize event, 2) *hide* the entire page control during resize (and replace with some "window size indicator"), or 3) develop my own custom controls. – Andreas Rejbrand Oct 27 '10 at 08:30
  • Are you using database controls? Than maybe TDataSet.DisableControls while updating / adding will help. – The_Fox Oct 27 '10 at 09:05
  • It would be helpful if you told us when and where the flickering occurs. – Andreas Rejbrand Oct 27 '10 at 09:05
  • @Andreas: the flicker happens whenever I resize the form – mjn Oct 27 '10 at 09:37
  • Yes, as I thought then! (I assume that the anchors of the page control includes at least one of `alRight` and `alBottom`?) – Andreas Rejbrand Oct 27 '10 at 09:41
  • @Andreas yes all Anchors are set to true, the Align property is alClient. – mjn Oct 27 '10 at 10:09

2 Answers2

5

Setting ParentBackground to False for components on the PageControl helped a lot. However this results in a different color of these panel components, they all have a darker background now. Maybe this can be fixed easily (without losing Theme support).

I also installed VCL Fix Pack which has a fix for QC 56252 (TPageControl flickers a lot with active theming).

mjn
  • 36,362
  • 28
  • 176
  • 378
0

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...

Wim ten Brink
  • 25,901
  • 20
  • 83
  • 149
  • Thank you for this idea. However now I think there is a solution - setting ParentBackground to False for components on the PageControl. I didn't know that creating a simple RAD GUI can be so tricky :) – mjn Oct 27 '10 at 15:35
  • There's no such thing as simple, when you have a mix of Windows common controls library code, and stuff that is not Windows controls. This is just the tip of the iceberg. – Warren P Feb 04 '11 at 21:25