<div class="meta" robots="noindex">

</div>

Method

# Graphics.DrawRect

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Graphics.DrawRectangle<graphics.drawrectangle>` as a replacement.

</div>

## Description

Draws the outline of a rectangle in the current color. The current color is set with the ForeColor property.

## Notes

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.

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

## Compatibility

All project types on all supported operating systems.
