Difference between revisions of "Graphics.DrawRect"

From Xojo Documentation

m (Text replacement - "{{Deprecated|" to "{{DeprecatedItem|")
Line 1: Line 1:
| name=DrawRect
| name=DrawRect

Latest revision as of 19:05, 3 September 2020


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

Supported for all project types and targets.

Draws the outline of a rectangle in the current color. The current color is set with the ForeColor 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 draws two squares with a 5-pixel red border.

g.ForeColor = &cff0000
g.PenWidth = 5
g.DrawRect(10, 10, 100, 100)
g.DrawRect(130, 10, 100, 100)