Board index » delphi » Double buffering problem with a PaintBox in a ScrollBox - canvas is drawn incompletely

Double buffering problem with a PaintBox in a ScrollBox - canvas is drawn incompletely

i use a PaintBox within a ScrollBox. the PaintBox is considerably bigger than the ScrollBox.
to prevent flickering, i use a TImage's canvas to draw and then use TCanvas.CopyRect to copy the TImage canvas to
the PaintBox canvas.

this results in the canvas to be copied incompletely. only the upper left part of the canvas is shown in the ScrollBox.
this part is of the same size like the clientsize of the ScrollBox at design time.

whats wrong ?
thanks in advance

carsten

 

Re:Double buffering problem with a PaintBox in a ScrollBox - canvas is drawn incompletely


Quote
"carsten ahl" <a...@arges.de> wrote in message news:392284b7@dnews...
> i use a PaintBox within a ScrollBox. the PaintBox is considerably bigger than the ScrollBox.

I don't understand.  The PaintBox is bigger, but is within the Scrollbox?

Quote
> to prevent flickering, i use a TImage's canvas to draw and then use TCanvas.CopyRect to copy the TImage canvas to
> the PaintBox canvas.

If you're using an in-memory bitmap for double buffering, why not use a TBitmap instead of a TImage?

Quote
> this results in the canvas to be copied incompletely. only the upper left part of the canvas is shown in the ScrollBox.
> this part is of the same size like the clientsize of the ScrollBox at design time.

Could you post a small code fragment showing what you're doing?

--
efg

Earl F. Glynn     E-mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Re:Double buffering problem with a PaintBox in a ScrollBox - canvas is drawn incompletely


All you need to do is set the Brush for the ScrollBox to bsClear;
Then use the Timage as the surface in the scroll box.
 You will not get any flickering any more..
Quote
carsten ahl wrote:
> i use a PaintBox within a ScrollBox. the PaintBox is considerably bigger than the ScrollBox.
> to prevent flickering, i use a TImage's canvas to draw and then use TCanvas.CopyRect to copy the TImage canvas to
> the PaintBox canvas.

> this results in the canvas to be copied incompletely. only the upper left part of the canvas is shown in the ScrollBox.
> this part is of the same size like the clientsize of the ScrollBox at design time.

> whats wrong ?
> thanks in advance

> carsten

Other Threads