Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TToolbar incompatible with TForm.DoubleBuffered?

I am using Delphi XE3.
When I create a new VCL project and drop a TToolbar on it, everything works fine - except when I activate Form1.DoubleBuffered.
From that moment on, drawing of the toolbar is broken - in designtime, it's either black, transparent, or parts of the IDE (statusbar, toolbar, etc.) are copied into it. It changes between these options when I click on it and when I change to source code (F12) and back.
In runtime, it's always black.

With DrawingStyle=dsGradient, everything works as expected. Switching back to dsNormal breaks it again.

Deactivating Form1.DoubleBuffered repairs it.

Any hints how to work around that issue?

like image 819
Pharaoh Avatar asked Mar 25 '13 09:03

Pharaoh


Video Answer


1 Answers

In my opinion the solution is to set TForm.DoubleBuffered to False. Using a value of True causes all sorts of other problems. This property worked reasonably well before XP themes, but since their arrival, using TForm.DoubleBuffered has not been viable, in my view.

In addition to the problems you have encountered, I've come across lots of painting flaws when using the Windows Basic theme. I know that's not mainstream, but I happen to see that a lot with remote access. And there's more. When you double buffer a form you stop the theme animation from working. For example, a default button pulses to indicate that it is the default button.

If you get resize flickering without double buffering the form, use the ideas from my answer to another question. From the comments it seems that the flickering you wish to combat is in a paint box. I obviously don't know the details, but my experience and instincts say that you should be able to deal quite easily with that flickering at a local level. There surely should be no need for the global form wide double buffering.

like image 63
David Heffernan Avatar answered Sep 30 '22 13:09

David Heffernan