This documentation is for the old version. Go to the latest Graphics Mill docs

Pen Class

This class defines settings of pen.

Namespace: Aurigma.GraphicsMill.Drawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public Class Pen _
	Implements ICloneable
C#
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, Width, DashStyle. Some properties are used to determine a behaviour of lines conjunctions, such as LineJoin and MiterLimit. To specify a shape of the line ends, use StartCap and EndCap 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 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 that returns empty pen. To check whether the pen is empty, use property IsEmpty.

Examples

Visual Basic
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)
C#
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
L 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





See Also

Reference