Question

I noticed that the resize flicker gets much better when I set TPanel.FullRepaint to False. Since the property exists and is True by default, there must be some reason for that.

How to decide whether it should be set or not?

The help just states:

FullRepaint controls how the panel responds when it is resized. When FullRepaint is true, the entire panel, including the beveled border repaints when the size changes. When FullRepaint is false, only the area inside the beveled border repaints.

http://docwiki.embarcadero.com/Libraries/XE3/en/Vcl.ExtCtrls.TPanel.FullRepaint

That text says what it does, but not why ...

Was it helpful?

Solution

The effect of a missing Fullrepaint can be shown and you will have to decide if you need it or not.

  1. Place a panel on a form, set anchors to all directions
  2. Set PaintCaption to false or use a empty caption
  3. Place another panel on the form, so that if you are resizing the form, parts of the first panel will be covered by the second panel.

Run the program and size the form, somtimes the borders of the first panel will not be refreshed.
This happens because in WMWindowPosChanged in case of (FullRepaint or (ShowCaption and (Caption <> ''))) a invalidate will be called, otherwise only InvalidateRect(Handle, Rect, True) of a rects only containing the right and/or bottom border are invalidated. (thanks to Sertac Akyuz for correction)

As you mentioned avoiding invalidate reduces flicker and in many cases the need for a full invalidate is not given, so the user can decide on his own how to proceed.

Panels as the rarely will be used, upper without Fullrepaint

OTHER TIPS

In previous versions of Windows (not sure up to which version, exactly) FullRepaint was required to prevent graphical artefacting on panel borders when a form was resized. To the best of my knowledge, this hasn't been an issue since at least Windows XP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top