Recent

Author Topic: [SOLVED] TPaintBox in a TFrame: flickering  (Read 7366 times)

DRIGUS

  • Jr. Member
  • **
  • Posts: 59
[SOLVED] TPaintBox in a TFrame: flickering
« on: August 05, 2011, 09:23:56 am »
Hi *.*.

  First of all, I discovered this problem on a Windows CE 6.0 device. But I believe it could be a LCL problem.

  I have a normal TForm with a TPaintBox on it. In order to avoid flickering I set TForm.DoubleBuffered to TRUE and use a TBitmap as buffer which is drawn by TPaintBox.Canvas.Draw in the event TPaintBox.OnPaint. If I need to update the display I use TPaintBox.Invalidate.
  This works as expected, without any flickering.

  I have another TForm with a (dynamical created) TFrame on it. This frame has a TPaintBox, too. I use the same approach like above, but I can't avoid flickering. TForm.DoubleBuffered is TRUE, setting TFrame.DoubleBuffered to TRUE doesn't change anything.
  It seems to me that the problem is the automatic erasing of the background which cause the flickering. Is there any chance to handle it? Under Windows I would perhaps try to catch WM_ERASEBK, first ...

  Edit: Lazarus 0.9.31 r31448 FPC 2.4.4 i386-win32-win32/win64

Greetings
« Last Edit: August 05, 2011, 11:00:14 am by DRIGUS »
DRIGUS GmbH

DRIGUS

  • Jr. Member
  • **
  • Posts: 59
Re: [SOLVED] TPaintBox in a TFrame: flickering
« Reply #1 on: August 05, 2011, 11:01:32 am »
Issue solved: I override TFrame.EraseBackground by an empty method to avoid flickering.

Greetings
DRIGUS GmbH

DRIGUS

  • Jr. Member
  • **
  • Posts: 59
Re: [SOLVED] TPaintBox in a TFrame: flickering
« Reply #2 on: August 17, 2011, 02:10:05 pm »
Addendum:

  Due to display problems, caused by not refreshing the TFrame outside the TPaintBox I searched for another solution.

  Until further notice I removed the method TFrame.EraseBackground again and use a TPanel with DoubleBuffered := TRUE as a container for the TPaintBox.

Greetings
DRIGUS GmbH

 

TinyPortal © 2005-2018