---
title: "GdiGraphics..::.DrawRectangle Method (Pen, Rectangle)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawRectangle_2_9fdf5c51.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# GdiGraphics.DrawRectangle Method (Pen, Rectangle)
 
Draws a rectangle.
 
**Namespace:** [Aurigma.GraphicsMill.Drawing](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Sub DrawRectangle ( _pen As Pen, _rect As Rectangle _
)
```
 
```csharp
public void DrawRectangle(Pen pen,Rectangle rect
)
```
 
### Parameters
 
 - pen
     - Type: [Aurigma.GraphicsMill.Drawing.Pen](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md)
 [Pen](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md) object which is used to outline a rectangle.

 - rect
     - Type: [System.Drawing.Rectangle](http://msdn2.microsoft.com/en-us/1zk39146)
The [Rectangle](http://msdn2.microsoft.com/en-us/1zk39146) object to draw.
 
## Remarks
 To fill a rectangle, use [FillRectangle(Brush, Rectangle)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_FillRectangle_2_d46d2e1e.htm.md) method. 
All the coordinates are measured in units specified with [Unit](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_UnitConverterObject_Unit.htm.md) property.
   
## See Also

### Reference

- [GdiGraphics Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
- [DrawRectangle Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawRectangle.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
