Create an image on a canvas that fills the entire canvas

in realstudio it was like that Example

Canvas2.Graphics.DrawPicture Foto1,0,0,Canvas2.Width,Canvas2.Height,0,0,Foto1.Width,Foto1.Height

in Xojo ??

You use almost the same code in the paint event:

G.DrawPicture Foto1,0,0,Canvas2.Width,Canvas2.Height,0,0,Foto1.Width,Foto1.Height

I would like to do this when the mouse hovers over a field
so i can’t put on the paint, as the images vary,
for this I was wondering how to view image from the data field to the canvas

thank you

In MouseDown do:

if condition then
   property = value
elseif other condition then
  property = other value
end if

And then in the Paint event you do:

if property = value then
   myPicture = some picture
elseif property = other value then
   myPicture = other picture
end if


And the link between the two events is a “Control.Invalidate” or “Control.Refresh”.

A long time ago, the Graphics property was useable outside of the control’s paint event. That’s no longer the case.