Edit

Share via


Pen.Alignment Property

Definition

Gets or sets the alignment for this Pen.

public:
 property System::Drawing::Drawing2D::PenAlignment Alignment { System::Drawing::Drawing2D::PenAlignment get(); void set(System::Drawing::Drawing2D::PenAlignment value); };
public System.Drawing.Drawing2D.PenAlignment Alignment { get; set; }
member this.Alignment : System.Drawing.Drawing2D.PenAlignment with get, set
Public Property Alignment As PenAlignment

Property Value

A PenAlignment that represents the alignment for this Pen.

Exceptions

The specified value is not a member of PenAlignment.

The Alignment property is set on an immutable Pen, such as those returned by the Pens class.

Remarks

This property determines how the Pen draws closed curves and polygons. The PenAlignment enumeration specifies five values; however, only two values - Center and Inset - will change the appearance of a drawn line. Center is the default value for this property and specifies that the width of the pen is centered on the outline of the curve or polygon. A value of Inset for this property specifies that the width of the pen is inside the outline of the curve or polygon. The other three values, Right, Left, and Outset, will result in a pen that is centered.

A Pen that has its alignment set to Inset will yield unreliable results, sometimes drawing in the inset position and sometimes in the centered position. Also, an inset pen cannot be used to draw compound lines and cannot draw dashed lines with Triangle dash caps.

Applies to