Pen.CompoundArray Property


Gets or sets an array of values that specifies a compound pen. A compound pen draws a compound line made up of parallel lines and spaces.

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

public float[] CompoundArray { get; set; }

Property Value

Type: System.Single[]

An array of real numbers that specifies the compound array. The elements in the array must be in increasing order, not less than 0, and not greater than 1.

Exception Condition

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

A compound line is made up of alternating parallel lines and spaces of varying widths. The values in the array specify the starting points of each component of the compound line relative to the pen's width. The first value in the array specifies where the first component (a line) begins as a fraction of the distance across the width of the pen. The second value in the array specifies the beginning of the next component (a space) as a fraction of the distance across the width of the pen. The final value in the array specifies where the last component ends.

Suppose you want a pen to draw two parallel lines where the width of the first line is 20 percent of the pen's width, the width of the space that separates the two lines is 50 percent of the pen' s width, and the width of the second line is 30 percent of the pen's width. Start by creating a Pen and an array of real numbers. Set the compound array by passing the array with the values 0.0, 0.2, 0.7, and 1.0 to this property.

Do not set this property if the Pen has its Alignment property set to Inset.

.NET Framework
Available since 1.1
Return to top