DrawRectangle does nothing

I have this code in the Paint event of a MobileCanvas:

g.DrawingColor = color.White
g.DrawOval(0, 0, 100, 100)
g.DrawRectangle(0, 0, 200, 300)

The MobileCanvas is enabled, visible, is on top of all other objects (there is a picture behind it) but it just doesn’t do anything. I see no oval and no rectangle. The paint event fires, I have set a breakpoint to make sure. I have no idea why it’s not showing anything.

Is there anything I need to do to make the canvas draw the oval and rectangle?

Thank you!

Works fine here. Are you sure the Canvas is on top? Perhaps try FillOval and FillRectangle as a test, which may be easier to see. Feel free to PM me your email address and I’ll send you over my project, in case it helps.

In a sample project with just a canvas and a button on the screen, it works for me too.

I just noticed that (in the real project) the Paint event is being called when the MobileScreen is loaded although I’m not calling the MobileCanvas.Refresh method when the screen is loaded. Is this some automatic thing?

The Paint event is NOT called when I call MobileCanvas.Refresh.


This sounds familiar. See MobileCanvas paint not firing

I’d you put a button on the view and click it, does refresh work?

Thanks for all your ideas & suggestions. I have no idea why but today it works. All I did was restarting my computer and Xojo.