## Graphics::DrawRectangle(const SharedPtr\<Pen\>\&, float, float, float, float) method


Draws the specified rectangle using the specified pen on the surface represented by the current object.

```cpp
void System::Drawing::Graphics::DrawRectangle(const SharedPtr<Pen> &pen, float x, float y, float width, float height)
```


| Parameter | Type | Description |
| --- | --- | --- |
| pen | const SharedPtr\<Pen\>\& | A pen to use when drawing the rectangle |
| x | float | The X coordinate of the upper left corner of the rectangle to draw |
| y | float | The Y coordinate of the upper left corner of the rectangle to draw |
| width | float | The width of the rectangle to draw |
| height | float | The height of the rectangle to draw |

## See Also

* Typedef [SharedPtr](../../../system/sharedptr/)
* Class [Pen](../../pen/)
* Class [Graphics](../)
* Namespace [System::Drawing](../../)
* Library [Aspose.PDF for C++](../../../)
## Graphics::DrawRectangle(const SharedPtr\<Pen\>\&, int, int, int, int) method


Draws the specified rectangle using the specified pen on the surface represented by the current object.

```cpp
void System::Drawing::Graphics::DrawRectangle(const SharedPtr<Pen> &pen, int x, int y, int width, int height)
```


| Parameter | Type | Description |
| --- | --- | --- |
| pen | const SharedPtr\<Pen\>\& | A pen to use when drawing the rectangle |
| x | int | The X coordinate of the upper left corner of the rectangle to draw |
| y | int | The Y coordinate of the upper left corner of the rectangle to draw |
| width | int | The width of the rectangle to draw |
| height | int | The height of the rectangle to draw |

## See Also

* Typedef [SharedPtr](../../../system/sharedptr/)
* Class [Pen](../../pen/)
* Class [Graphics](../)
* Namespace [System::Drawing](../../)
* Library [Aspose.PDF for C++](../../../)
## Graphics::DrawRectangle(const SharedPtr\<Pen\>\&, Rectangle) method


Draws the specified rectangle using the specified pen on the surface represented by the current object.

```cpp
void System::Drawing::Graphics::DrawRectangle(const SharedPtr<Pen> &pen, Rectangle rect)
```


| Parameter | Type | Description |
| --- | --- | --- |
| pen | const SharedPtr\<Pen\>\& | A pen to use when drawing the rectangle |
| rect | Rectangle | A [Rectangle](../../rectangle/) object that specifies the location and size of the rectangle to draw |

## See Also

* Typedef [SharedPtr](../../../system/sharedptr/)
* Class [Pen](../../pen/)
* Class [Rectangle](../../rectangle/)
* Class [Graphics](../)
* Namespace [System::Drawing](../../)
* Library [Aspose.PDF for C++](../../../)
