Paint w/o paint handler

Is there any way for me to paint to a canvas() without going to the paint handler. Example:

canvas(n) Mousedown handler:
drawstuff me.graphics

Method Drawstuff(g): Dim P As New FigureShape
make a figure in the canvas
g.DrawObject P

This is the actual call:
drawPrism me.graphics, val(TSides.text), 50, .2, me.index rem draws a polygon
(drawPrism, graphics, sides, size, rotation, canvas index)
it works only in the paint routine with g.DrawObject P in the DrawPrism method
I want to redraw this polygon in other methods using the drawPrism routine…but it only works in Paint.

create a buffering picture and draw to that
the in the paint event you just draw that picture

[quote=206666:@Carl Gibson]This is the actual call:
drawPrism me.graphics, val(TSides.text), 50, .2, me.index rem draws a polygon
(drawPrism, graphics, sides, size, rotation, canvas index)
it works only in the paint routine with g.DrawObject P in the DrawPrism method
I want to redraw this polygon in other methods using the drawPrism routine…but it only works in Paint.[/quote]

You can also draw in the Backdrop graphics.

Create a picture the size of the canvas, make it the backdrop of the canvas, then you can draw to the graphics of the picture.

However, if you chose to do that, all drawing must take place there. Even paint must draw to

me.backdrop.graphics

instead of g.

[quote=206692:@Michel Bujardet]You can also draw in the Backdrop graphics.

Create a picture the size of the canvas, make it the backdrop of the canvas, then you can draw to the graphics of the picture.

However, if you chose to do that, all drawing must take place there. Even paint must draw to

me.backdrop.graphics

instead of g.[/quote]
that basically functions the same as having a buffer since you’re just drawing to a pictures graphics in either case

Sure. But using Backdrop, drawPicture in Paint is not necessary.

Basically, the buffer is displayed by the canvas itself.

Just remember to refresh the canvas so your changes to the background image will be drawn to the screen.