{{< psd/tize >}}
## DrawRectangle(Pen, RectangleF) {#drawrectangle_1}

Draws a rectangle specified by a [`RectangleF`](../../rectanglef/) structure.

```csharp
public void DrawRectangle(Pen pen, RectangleF rect)
```

| Parameter | Type | Description |
| --- | --- | --- |
| pen | Pen | A [`Pen`](../../pen/) that determines the color, width, and style of the rectangle. |
| rect | RectangleF | A [`RectangleF`](../../rectanglef/) structure that represents the rectangle to draw. |

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *pen* is null. |

### See Also

* class [Pen](../../pen/)
* struct [RectangleF](../../rectanglef/)
* class [Graphics](../)
* namespace [Aspose.PSD](../../../aspose.psd/)
* assembly [Aspose.PSD](../../../)

---

## DrawRectangle(Pen, Rectangle) {#drawrectangle}

Draws a rectangle specified by a [`Rectangle`](../../rectangle/) structure.

```csharp
public void DrawRectangle(Pen pen, Rectangle rect)
```

| Parameter | Type | Description |
| --- | --- | --- |
| pen | Pen | A [`Pen`](../../pen/) that determines the color, width, and style of the rectangle. |
| rect | Rectangle | A [`Rectangle`](../../rectangle/) structure that represents the rectangle to draw. |

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *pen* is null. |

### See Also

* class [Pen](../../pen/)
* struct [Rectangle](../../rectangle/)
* class [Graphics](../)
* namespace [Aspose.PSD](../../../aspose.psd/)
* assembly [Aspose.PSD](../../../)

---

## DrawRectangle(Pen, float, float, float, float) {#drawrectangle_3}

Draws a rectangle specified by a coordinate pair, a width, and a height.

```csharp
public void DrawRectangle(Pen pen, float x, float y, float width, float height)
```

| Parameter | Type | Description |
| --- | --- | --- |
| pen | Pen | A [`Pen`](../../pen/) that determines the color, width, and style of the rectangle. |
| x | Single | The x-coordinate of the upper-left corner of the rectangle to draw. |
| y | Single | The y-coordinate of the upper-left corner of the rectangle to draw. |
| width | Single | The width of the rectangle to draw. |
| height | Single | The height of the rectangle to draw. |

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *pen* is null. |

### See Also

* class [Pen](../../pen/)
* class [Graphics](../)
* namespace [Aspose.PSD](../../../aspose.psd/)
* assembly [Aspose.PSD](../../../)

---

## DrawRectangle(Pen, int, int, int, int) {#drawrectangle_2}

Draws a rectangle specified by a coordinate pair, a width, and a height.

```csharp
public void DrawRectangle(Pen pen, int x, int y, int width, int height)
```

| Parameter | Type | Description |
| --- | --- | --- |
| pen | Pen | [`Pen`](../../pen/) that determines the color, width, and style of the rectangle. |
| x | Int32 | The x-coordinate of the upper-left corner of the rectangle to draw. |
| y | Int32 | The y-coordinate of the upper-left corner of the rectangle to draw. |
| width | Int32 | Width of the rectangle to draw. |
| height | Int32 | Height of the rectangle to draw. |

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *pen* is null. |

### See Also

* class [Pen](../../pen/)
* class [Graphics](../)
* namespace [Aspose.PSD](../../../aspose.psd/)
* assembly [Aspose.PSD](../../../)


