---
title: "Graphics.DrawLine Method (Pen, Single, Single, Single, Single)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawLine_5_b3708ac1.htm
product: "Graphics Mill"
---

# Graphics.DrawLine Method (Pen, Single, Single, Single, Single)
 
Draws a line connecting the two points specified by the coordinate pairs.
 
**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 DrawLine(Pen pen,float x1,float y1,float x2,float y2
)
```
 
### 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 line.

 - x1
     - Type: System.Single
The x-coordinate of the first point.

 - y1
     - Type: System.Single
The y-coordinate of the first point.

 - x2
     - Type: System.Single
The x-coordinate of the second point.

 - y2
     - Type: System.Single
The y-coordinate of the second point.
 
## Remarks
  
In this method line is defined with two points which should be connected with this line.
 
## Examples
  
```csharp
using (var bitmap = new Bitmap(160, 120, PixelFormat.Format24bppRgb, RgbColor.White))
using (var graphics = bitmap.GetGraphics())
{
    graphics.DrawLine(new Pen(RgbColor.Red), 10, 10, 150, 110);
    bitmap.Save(@"Images\Output\out.png");
}
```
   
## See Also

### Reference

- [Graphics Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Graphics.htm.md)
- [DrawLine Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_Drawing_Graphics_DrawLine.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Drawing.htm.md)

### Manual

- [Graphics: Drawing Images and Geometric Shapes](https://www.graphicsmill.com/docs/gm/graphics.htm.md)
