Invalidate Canvas

I am trying to repaint a canvas from a method, however, writing Canvas2.invalidate (the name of the canvas is Canvas2 in case that wasn’t clear) comes up with two errors, ‘This item doesn’t exist’, and ‘Type “Int32” has no member named “invalidate”’. What can I do to prevent this, or otherwise refresh/invalidate the canvas?

Where is the method in relation to Canvas2? You may need to fully qualify the name, such as:


Don’t forget that the drawing of the canvas should be done in the canvas’s Paint Event handler.

You issue Invalidate in Paint ?

Not unless you want an infinite loop :slight_smile:

As long as the Paint event does all the drawing, you just do invalidate() from wherever else you need to.

Your previous entry may lead to what I asked. Your last entry clear that.

Sometimes a clear statement is needed to avoid mistakes.