Nice Paint for Delphi

I develop some of my applications with Delphi. Delphi was light years ahead of its competitors when it was created and it is still a nice development environment.

Here I present a “beta” component that minimize “flickering” when the VCL draw windows. Applications written in Delphi flicker because Delphi does not use double buffering. Delphi draw directly to the desktop.

  • The background of a window is “painted” in the WM_ERASEBKGND message handler.
  • The other parts of a window is “painted” in the WM_PAINT message handler.

The individual steps of this process can be seen (must often only as flickering). In order to avoid the flickering the individual steps must be performed in a hidden place (a double buffer) and then the final result is painted to the desktop. I have created a component that will “patch” the normal Delphi controls to use double buffering.

The double buffering principle I use, does not work with some controls. But there is another possibility. If a control draw the entire window in the WM_PAINT handler, the WM_ERASEBKGND step can be omitted. This will not remove all flickering but in general it works quite well.

Version History