From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aGraphics.Width

Supported for all project types and targets.

The width in pixels of the parent object, typically a Canvas control or a Window.

For example, if the graphics class object is in a Canvas control, Width returns the width of the control.


This example in the Canvas.Paint event draws a box the width of the Canvas itself:

g.DrawingColor = &c0000ff
g.FillRectangle(0, 0, g.Width, g.Height)