R – Delphi Form Painting Black Flash When Restoring

delphiformspaint

When I minimize and restore my Delphi application, the window contents flash a horrible black before (re)painting on Vista/Win7. This can also be seen with the Delphi 2007 IDE – the Object Inspector, Project Manager, Messages window (but not the editor contents) also flash black when restoring.

None of the ususal flicker-free painting techniques seem to make any difference, and some even make it worse: DoubleBuffered, WS_EX_COMPOSITED, WM_ERASEBKGND, etc.

Most Microsoft applications do not exhibit this behavior. Is this a problem with Delphi's implementation of Windows forms? Does anyone know of a workaround?

Best Answer

When you register your window class, set hbrBackground to (HBRUSH)(COLOR_3DFACE + 1)

Related Topic