How to draw into a canvas that has a set backdrop

I am am setting a canvas with a picture using “canvas1.backdrop = picture” and I was wondering, is there any way I can access the graphics property of the canvas to draw a rectangle on top of the picture? when I try to do “Canvas1.Backdrop.Graphics.DrawRect 23,156,231,44” i get a nil object exception…

Canvas1.Graphics.DrawRect 23,156,231,44

in the canvas paint event/method you can draw over the background.
you could also use the picture.Graphics to draw something before you assign the image as backdrop.

1 Like

You cant do that in any recent recent version of Xojo
You must use g.DrawRect 23,156,231,44 in the paint event.

You can do
picture.graphics.DrawRect 23,156,231,44

then

canvas1.backdrop = picture

1 Like