Institute graphics object as BackBuffer

I am struggling to work out how to make a BackBuffer that simulates a graphics object. If you could please convert this made up code into working out, that would be nice?

'inistitute graphics object that is not drawn to the screen and draw a line on it
dim gb as GraphicsBuffer
gb.drawLine 0,0,200,0
'set the 'g' variable from one of the perameters in the paint event to the graphical contents of the graphics buffer
g = gb

Thanks in advance!

dim p as new picture(300,300,32)
dim g as graphics
g=p.graphics
g.drawline 0,0,200,0

Not sure of your intent… but if you want to use this to draw STATIC image for a CANVAS… make P global instead of local

and in your PAINT event

g.drawpicture p,0,0

[quote=37184:@Dave S] dim p as new picture(300,300,32) dim g as graphics g=p.graphics g.drawline 0,0,200,0

Not sure of your intent… but if you want to use this to draw STATIC image for a CANVAS… make P global instead of local

and in your PAINT event

g.drawpicture p,0,0 [/quote]
Thanks, I will try this.