Canvas to another canvas

It should be obvious and easy but I can’t find the way to:
Having a canvas with images and text, etc, I want to copy the full canvas image to another canvas at reduced size. Should be as easy as:

g.DrawPicture(origenCanvasImage, 0, 0, scaledWidth, scaledHeight, 0, 0, oldCanvasImage.Width, oldCanvasImage.Height) 

But, silly of me, I can’t find how to get the image of the origencanvas.

a canvas is basically a non-persistent object, hence the use of the PAINT event.
So instead of drawing to the first canvas, create a PICTURE object and display IT instead

So, create a pict and then display it in the first canvas, then reduce the pict and display in the second canvas? because there is not a way to get the picture from the canvas 1.

yup… the DRAWPICTURE command can rescale it for you

thanks Dave, the problem was I would get the picture from the canvas but I should first create a global picture fill it and then draw into the first canvas, then Draw to the second canvas scaling it. It works now, I tried to avoid another global.

Not necessay to be a global, it can be only a window Property.

Do not forget, in the Paint Event, to check the Picture against Nil before displaying it.

Hi @Enric Herrera

Maybe you can consider the DrawInto method for that too? You can find the documentation about it here

[quote=464154:@Javier Menéndez]Hi @Enric Herrera

Maybe you can consider the DrawInto method for that too? You can find the documentation about it here[/quote]
You’re right this works without a global or window global

[quote]Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
Var p As New Picture(Canvas1.Width, Canvas1.Height)
Canvas1.DrawInto(p.Graphics, 0, 0)

if p <> nil then
g.DrawPicture(p,0,0,me.width,me.height, 0,0, p.Width,p.Height)
end if

End Sub
[/quote]