[Lazarus] Calling DrawFocusRect() outside the Paint() event

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Oct 10 14:53:18 CEST 2016


On Mon, 10 Oct 2016 14:05:56 +0200 (CEST)
Michael Van Canneyt <michael at freepascal.org> wrote:

>[...]
> But the effect is that inside the Paint() event you are actually drawing to a bitmap (buffer), 
> which is then swapped to the display once the paint method is done ?

The effect is that you can do small draws inside and outside the paint
event and only need a draw bitmap in OnPaint. Which depending on your
control might be faster than drawing everything on every OnPaint.

If you instead can optimize your OnPaint event you don't need this
bitmap.

And if you target only Windows+Gtk, you can draw outside OnPaint and
don't need the bitmap either.


> So why would I want to introduce a third buffer, which is then copied to the second, which is then copied to the actual display ?

Copying compatible bitmaps is pretty fast.

Mattias


More information about the Lazarus mailing list