From Xojo Documentation


Graphics.FillRectangle(x As Double, y As Double, width As Double, height As Double)

New in 2019r2

Supported for all project types and targets.

Draws a rectangle filled with the current color. The current color is set with the DrawingColor property.


X and Y are the coordinates of the top-left corner. Width and Height specify the size of the rectangle.

Sample Code

This example (in the Paint event of a Canvas control) draws a rectangle with a red interior.

g.DrawingColor = &cff0000 // Red
g.FillRectangle(10, 10, 100, 60)