Prior to Xojo 2018r3 Window and Canvas both had a Graphics property that you could access and draw to. This was deprecated in 2011 because it had significant performance issues on all platforms. The preferred way to draw your graphics since 2011 has been to use the Window.Paint or Canvas.Paint event handlers and the supplied parameter g As Graphics.
Starting with Xojo 2018r3, this Graphics property was removed from Window and Canvas so if you had code that was still relying on it, that code will no longer compile. Here are some tips on how you can migrate your code to use the Paint event handlers and tell the Canvas to update with a call to Invalidate.
If your code was simple and just drawing a Picture to the Graphics property, then you would just move the code to the Paint event handler. For example, this code is drawing a picture:
Canvas1.Graphics.DrawPicture(MyPic, 0, 0)
Where that code existed, you would tell it to redraw Canvas1:
And then in the Canvas.Paint event handler you would draw the picture:
g.DrawPicture(MyPic, 0, 0)
Related to this is another thing to keep in mind. Do not use this Graphics object (g) outside the lifetime of the Paint event. You can certainly pass the Graphics parameter from the Paint event to other methods, but you should not keep a reference of it in a property or elsewhere. When the Paint event eventually completes, this Graphics object is no longer valid and the copy you’ve saved in a property also becomes invalid. Attempting to use a saved Graphics object outside of the Paint event’s lifetime may raise an exception in future versions of Xojo.
For more information and other strategies to handle more advanced situations, refer to the topic in the documentation: Updating Code That Used the Graphics Property