Board index » delphi » Copy canvas to Canvas?

Copy canvas to Canvas?

Hi,

My paintbox flickers when I redraw. I want to paint a different canvas
on the background and copy the contens to the visible one. Is that
possible ?

Ebo

 

Re:Copy canvas to Canvas?


Simply create an instance of TBitmap, and set it's width,height &
pixelformat properties.  You can the use it's canvas like anyother, only
it's not attached to a window so it's not visible.  To copy the bitmaps
data to the PaintBox check out the copyRect or stretchDraw methods (or
the bitblt etc winapi func's)
Quote
Ebo Dieben wrote:

> Hi,

> My paintbox flickers when I redraw. I want to paint a different canvas
> on the background and copy the contens to the visible one. Is that
> possible ?

> Ebo

Re:Copy canvas to Canvas?


Be sure to include csOpaque in the ComponentStyle of the drawing component
to avoid clearing the background before every paint.

constructor TMyDrawing.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ComponentStyle := ComponentStyle + [csOpaque];
end;

Per

Michael Edey <e...@hotmail.com> wrote in article
<36143BA7.69805...@hotmail.com>...

Quote
> Simply create an instance of TBitmap, and set it's width,height &
> pixelformat properties.  You can the use it's canvas like anyother, only
> it's not attached to a window so it's not visible.  To copy the bitmaps
> data to the PaintBox check out the copyRect or stretchDraw methods (or
> the bitblt etc winapi func's)

> Ebo Dieben wrote:

> > Hi,

> > My paintbox flickers when I redraw. I want to paint a different canvas
> > on the background and copy the contens to the visible one. Is that
> > possible ?

> > Ebo

Re:Copy canvas to Canvas?


Good Idea, it works perfectly.
Thanks,
Ebo.
P.S. I'm trying the Opaque bit for reducing the flickering in my
dbgrid (not ready yet)

On Fri, 02 Oct 1998 02:36:11 GMT, Michael Edey <e...@hotmail.com>
wrote:

Quote
>Simply create an instance of TBitmap, and set it's width,height &
>pixelformat properties.  You can the use it's canvas like anyother, only
>it's not attached to a window so it's not visible.  To copy the bitmaps
>data to the PaintBox check out the copyRect or stretchDraw methods (or
>the bitblt etc winapi func's)

>Ebo Dieben wrote:

>> Hi,

>> My paintbox flickers when I redraw. I want to paint a different canvas
>> on the background and copy the contens to the visible one. Is that
>> possible ?

>> Ebo

Other Threads