Please search the forum. This process was removed from Xojo years ago… All actions on the graphics context of a Canvas must be initiated by the PAINT event. This same issue was brought up just a day or two ago.
One simple way to handle this is to add a public color property to the app, (or the window, or a module)
Dim selectedcolor as color = &cc0c0c0
Then change you click code to be this (assuming the property is on the app)
app.selectedcolor = c
me.invalidate
and put this into the Canvas’ Paint() event
me.Draw g
Oddly, the object referred to in me.Draw would be the Canvas, and the canvas does not have a Draw method
Is this a custom class derived from a canvas?
If it is, the selectedColor property could be part of the class