I am working through some samples in the book and am confused by the canvas. There isn’t a Canvas control and I get a compile error that g does not exist. When checking the wiki on the Canvas.Paint method it says this…
Directly accessing the Graphics property of the Canvas has been removed as of 2018r3. Use this event instead for all drawing.
My simple code is below. What am I missing? I am using xojo 2019r3 on windows 10
Dim f As FolderItem
Dim d As OpenFileDialog
d = New OpenFileDialog
f = d.ShowModal()
If f <> Nil Then
myPic = Picture.Open(f)
End If
If MyPic <> Nil Then
g.DrawPicture(MyPic, 10, 10)
End If
Place a Canvas Control in the window. Add the paint event to it. This passes g As Graphics as a parameter, so that you can then access the Graphics object of a canvas. For example, you can open the image by clicking on a PushButton and update the canvas with Canvas1.Invalidate(False).
The paint event could then look something like this:
If MyPic <> Nil Then
g.DrawPicture(MyPic, 10, 10)
End If
OMG. I look over the controls again and again. When you said it was in decorations it was the first one. Now I cant help but see it.
All is working now even the scaling I wanted.
Thank you!