.NET Framework Class Library
Pen..::.Alignment Property

Gets or sets the alignment for this Pen.

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)
Syntax

Visual Basic (Declaration)
Public Property Alignment As PenAlignment
Visual Basic (Usage)
Dim instance As Pen
Dim value As PenAlignment

value = instance.Alignment

instance.Alignment = value
C#
public PenAlignment Alignment { get; set; }
Visual C++
public:
property PenAlignment Alignment {
    PenAlignment get ();
    void set (PenAlignment value);
}
JScript
public function get Alignment () : PenAlignment
public function set Alignment (value : PenAlignment)

Property Value

Type: System.Drawing.Drawing2D..::.PenAlignment
A PenAlignment that represents the alignment for this Pen.
Exceptions

ExceptionCondition
InvalidEnumArgumentException

The specified value is not a member of PenAlignment.

ArgumentException

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.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
See Also

Reference

Tags :


Page view tracker