---
title: "Graphics.DrawRectangles Method "
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawRectangles_2_8b12e7a5.htm
product: "Graphics Mill"
---

# Graphics.DrawRectangles Method 
 
Draws a number of rectangles specified by an array of RectangleF structures.
 
**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 DrawRectangles(Pen pen,RectangleF[] rectangles
)
```
 
### 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.

 - rectangles
     - Type: System.Drawing.RectangleF[]
An array of RectangleF structures that represents the rectangles to draw.
 
## Remarks
  
To draw filled rectangles, use [FillRectangles(Brush, RectangleF\[\])](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_FillRectangles_2_ef918e12.htm.md) method.
 
## Examples
  
```csharp
using (var bitmap = new Bitmap(200, 80, PixelFormat.Format24bppRgb, RgbColor.White))
{
    var graphics = bitmap.GetGraphics();
    System.Drawing.RectangleF[] rectangles = {
        new System.Drawing.RectangleF(10, 60, 10, 60),
        new System.Drawing.RectangleF(40, 20, 10, 60),
        new System.Drawing.RectangleF(70,  60, 10, 60),
        new System.Drawing.RectangleF(130, 60, 10, 60),
        new System.Drawing.RectangleF(160, 20, 10, 60),
        new System.Drawing.RectangleF(190, 60, 10, 60),
        new System.Drawing.RectangleF(40, 20, 10, 60)};
    graphics.DrawRectangles(new Pen(RgbColor.Black), rectangles);
    bitmap.Save(@"Images\Output\out.png");
}
```
   
## See Also

### Reference

- [Graphics Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Graphics.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Drawing.htm.md)
- [Graphics.FillRectangles(Brush, RectangleF\[\])](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_FillRectangles_2_ef918e12.htm.md)

### Manual

- [Graphics: Drawing Images and Geometric Shapes](https://www.graphicsmill.com/docs/gm/graphics.htm.md)
