Objo.
Feedback Forum Docs Objo Studio
Feedback

Bug #1141

Canvas Paint handlers now receive the Canvas as Me

Status
Fixed
Fixed in
v26.8.4
Source discussion
https://forum.objo.dev/d/805-graphicstextheight/5
Last updated
2026-08-17

Upvotes

0 upvotes

Uses your Objo forum account.

Public summary

Inside a Window-owned Canvas.Paint event handler (for example Sub Canvas1_Paint(g As Graphics)), the Me keyword incorrectly referred to the containing Window instead of the Canvas. The language contract for event handlers is that Me is the event source and Self is the subscriber or object that owns the handler, so Me inside a Canvas.Paint handler must be the Canvas.

As a direct consequence, reported code such as:

g.TextAlignment = TextAlignment.Centre
g.VerticalTextAlignment = TextAlignment.Middle
g.DrawText("test", 0, 0, Me.Width, Me.Height)

inside a 200×200 Canvas on an 800×600 Window laid the text out for the Window's dimensions, so the centred text was positioned far outside the Canvas's clipping area and appeared to be missing entirely. With the fix, Me is the Canvas, so Me.Width and Me.Height return the Canvas's dimensions and centred text is laid out inside the Canvas. Self correctly refers to the containing Window.

Objo.

Build apps visually, deploy anywhere.

Feedback is a public read-only status mirror for Objo Studio.