Pen


PenHierarchy: DependencyObject Freezable Animatable

 <Pen     Brush="Blue"     Thickness="1"     DashCap="Flat|Round|Square|Triangle"     EndLineCap="Flat|Round|Square|Triangle"     LineJoin="Bevel|Miter|Round"     MiterLimit="1"     StartLineCap="Flat|Round|Square|Triangle" /> 

<Pen .../> describes how an element is outlined. Figure 7-8 shows two drawings, each drawn with a different Pen. The first Pen is black with a thickness of 2 and uses triangle and Round as start and end line caps. The second Pen is blue with a thickness of 1 and uses Square and Flat as start and end line caps. The code to produce this figure is shown in Example 7-5.

Figure 7-8. Different styles of Pen


Attributes


Brush (optional)

Describes how the object is filled. The value of this attribute may be a reference to a predefined Color (see Appendix G) or it may be a defined Brush. Although the Brush attribute is optional, no outline will be shown if it is not set to something other than the default, transparent.


DashCap (optional)

Describes how the ends of a dash are drawn.


Flat

No line cap. This is the default.


Round

The line is capped with a semicircle equal in diameter to the line thickness.


Square

The line is capped with a square whose sides are equal in length to the line thickness.


Triangle

The line is capped with a triangle equal in height to the line thickness.


EndLineCap (optional)

Sets the shape used to end a stroke.


Flat

No line cap. This is the default.


Round

The line is capped with a semicircle equal in diameter to the line thickness.


Square

The line is capped with a square whose sides are equal in length to the line thickness.


Triangle

The line is capped with a triangle equal in height to the line thickness.


LineJoin (optional)

Sets the type of joint used at the vertices of a shape's outline.


Bevel

Beveled vertices


Miter

Regular angular vertices


Round

Rounded vertices


MiterLimit (optional)

A miter is created when the ends of two surfaces with angles other than 90 degrees are joined to form a corner. This attribute sets the limit on the ratio of the miter length to the thickness of the Pen. This value must be a positive number greater than or equal to 1.0 and is expressed as a Double.


StartLineCap (optional)

Sets the type of shape to be used at the beginning of a line.


Flat

No line cap. This is the default.


Round

The line is capped with a semicircle equal in diameter to the line thickness.


Square

The line is capped with a square whose sides are equal in length to the line thickness.


Triangle

The line is capped with a triangle equal in height to the line thickness.


Thickness (optional)

The width of the stroke. The default is 1.0. This attribute is expressed as a Double.




XAML in a Nutshell
XAML in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596526733
EAN: 2147483647
Year: 2007
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net