---
title: "Graphics.DrawRectangle Method (Pen, RectangleF)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawRectangle_2_169e24a7.htm
product: "Graphics Mill"
---

# Graphics.DrawRectangle Method (Pen, RectangleF)
 
Draws a rectangle specified by a RectangleF structure.
 
**Namespace:** [Aurigma.GraphicsMill.Drawing](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Drawing.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public void DrawRectangle(Pen pen,RectangleF rectangle
)
```
 
### Parameters
 
 - pen
     - Type: [Aurigma.GraphicsMill.Drawing.Pen](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md)
A [Pen](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md) that determines the color, width, and style of the rectangle.

 - rectangle
     - Type: System.Drawing.RectangleF
 
## Remarks
  
To fill a rectangle, use [FillRectangle(Brush, RectangleF)](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_FillRectangle_2_9763ccb2.htm.md) method.
 
## Examples
  
```csharp
using (var bitmap = new Bitmap(80, 80, PixelFormat.Format24bppRgb, RgbColor.White))
using (var graphics = bitmap.GetGraphics())
{
    graphics.DrawRectangle(new Pen(RgbColor.Blue), new System.Drawing.Rectangle(10, 10, 60, 60));
    bitmap.Save(@"Images\Output\out.png");
}
```
   
## See Also

### Reference

- [Graphics Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Graphics.htm.md)
- [DrawRectangle Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_Drawing_Graphics_DrawRectangle.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Drawing.htm.md)
- [Graphics.FillRectangle(Brush, RectangleF)](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_FillRectangle_2_9763ccb2.htm.md)

### Manual

- [Graphics: Drawing Images and Geometric Shapes](https://www.graphicsmill.com/docs/gm/graphics.htm.md)
