---
title: "Pen Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.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/)

# Pen Class
 
This class defines settings of pen.
 
**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 Class Pen _Implements ICloneable
```
 
```csharp
public class Pen : ICloneable
```
 
## Remarks
  
Pen is an object which is used to draw lines, curves, and outline shapes. You can specify a number of pen settings: [Color](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_Color.htm.md), [Width](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_Width.htm.md), [DashStyle](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_DashStyle.htm.md). Some properties are used to determine a behaviour of lines conjunctions, such as [LineJoin](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_LineJoin.htm.md) and [MiterLimit](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_MiterLimit.htm.md). To specify a shape of the line ends, use [StartCap](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_StartCap.htm.md) and [EndCap](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_EndCap.htm.md) properties.
 
When you draw closed shapes such as rectangles, ellipses, etc with a pen of large width (which is more than 1), there is an important parameter [Alignment](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_Alignment.htm.md) that specifies the direction to widen the line (both directions evenly or inside the shape).
 
If you need to get an invisible pen, use a static property [Empty](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_Empty.htm.md) that returns empty pen. To check whether the pen is empty, use property [IsEmpty](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_IsEmpty.htm.md).
 
## Examples
  
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap( _
 Aurigma.GraphicsMill.RgbColor.White, 100, 60, _
 Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)

Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics()

Dim bluePen As New Aurigma.GraphicsMill.Drawing.Pen(Aurigma.GraphicsMill.RgbColor.Blue, 8)

graphics.DrawLine(bluePen, 10, 55, 90, 5)

Dim redPen As New Aurigma.GraphicsMill.Drawing.Pen(Aurigma.GraphicsMill.RgbColor.Red, 8)

graphics.DrawLine(redPen, 10, 5, 90, 55)
```
 
```csharp
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(
    Aurigma.GraphicsMill.RgbColor.White, 100, 60, 
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();

Aurigma.GraphicsMill.Drawing.Pen bluePen = new Aurigma.GraphicsMill.Drawing.Pen(
    Aurigma.GraphicsMill.RgbColor.Blue, 8);

graphics.DrawLine(bluePen, 10, 55, 90, 5);

Aurigma.GraphicsMill.Drawing.Pen redPen = new Aurigma.GraphicsMill.Drawing.Pen(
    Aurigma.GraphicsMill.RgbColor.Red, 8);

graphics.DrawLine(redPen, 10, 5, 90, 55);
```
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - Aurigma.GraphicsMill.Drawing.Pen
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_303.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_304.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_305.png)
  
## See Also

### Reference

- [Pen Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Drawing_Pen.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
