Use Draw inMemory Canvas

HI there,
I’m trying to make a Canvas in Memory (not on any view) and the draw polygons into the Canvas. After I’ll save the Canvas as PNG in a database.

I’m trying to access ‘Graphics’ but IDE tells me that its restricted to Within Method

Var FloorDrawing As New FloorCanvas (myClass: Super = Canvas)
FloorDrawing.SetSize(Ceil(rs_Floors.Column(“MaxX”).DoubleValue), Ceil(rs_Floors.Column(“MaxY”).DoubleValue) )
FloorDrawing.PaintPath(p, RoomColor)

Method PaintPath:
Me.DrawingColor = c

Create a picture and draw into that. Your Canvas paint event can then draw the picture to the screen if required.