Skip to main content

Pen Class

NuGet: GHIElectronics.TinyCLR.Drawing
Assembly: GHIElectronics.TinyCLR.Drawing
Namespace: System.Drawing

Defines an object used to draw lines and outlines — color, width, and brush.

public sealed class Pen : MarshalByRefObject, ICloneable, IDisposable

Constructors​

Pen(Color color)​

public Pen(Color color) : this(color, 1.0f)

Initializes a new pen of width 1 with the specified color.

Pen(Brush brush)​

public Pen(Brush brush) : this(brush, 1.0f)

Initializes a new pen of width 1 with the specified brush.

Pen(Color color, float width)​

public Pen(Color color, float width)

Initializes a new pen with the specified color and width.

Pen(Brush brush, float width)​

public Pen(Brush brush, float width)

Initializes a new pen with the specified brush and width.

Properties​

Width​

public float Width { get; set; }

Gets or sets the width of this pen in pixels.

Color​

public Color Color { get; set; }

Gets or sets the color of this pen.

PenType​

public PenType PenType { get; }

Gets the style of this pen.

Brush​

public Brush Brush { get; set; }

Gets or sets the brush used by this pen; only a solid brush is supported.

Methods​

Dispose()​

public void Dispose()

Releases the resources used by this pen.

Clone()​

public object Clone()

Creates an exact copy of this pen.

Returns object