PenLineCap Enumeration
Describes the shape at the end of a line or segment.
Assembly: PresentationCore (in PresentationCore.dll)
| Member name | Description | |
|---|---|---|
| Flat | A cap that does not extend past the last point of the line. Comparable to no line cap. | |
| Square | A rectangle that has a height equal to the line thickness and a length equal to half the line thickness. | |
| Round | A semicircle that has a diameter equal to the line thickness. | |
| Triangle | An isosceles right triangle whose base length is equal to the thickness of the line. |
This example shows how to modify the shape at the start or end of an open Shape element. To change the cap at the beginning of an open Shape, use its StrokeStartLineCap property. To change the cap at the end of an open Shape, use its StrokeEndLineCap property. To view the available line caps, see the PenLineCap enumeration.
The following example draws four Polyline elements and uses a different set of shapes on the ends of each.
<TextBlock Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="2"> <Bold>Line Caps</Bold> </TextBlock> <TextBlock Grid.Column="3" Grid.Row="1">Flat</TextBlock> <Polyline Points="50,50 75,30 100,100 130,40" Stroke="Red" StrokeThickness="20" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat" Grid.Row="1" Grid.Column="4"/> <TextBlock Grid.Column="3" Grid.Row="2">Square</TextBlock> <Polyline Points="50,50 75,30 100,100 130,40" Stroke="Red" StrokeThickness="20" StrokeStartLineCap="Square" StrokeEndLineCap="Square" Grid.Row="2" Grid.Column="4"/> <TextBlock Grid.Column="3" Grid.Row="3">Round</TextBlock> <Polyline Points="50,50 75,30 100,100 130,40" Stroke="Red" StrokeThickness="20" StrokeStartLineCap="Round" StrokeEndLineCap="Round" Grid.Row="3" Grid.Column="4"/> <TextBlock Grid.Column="3" Grid.Row="4">Triangle</TextBlock> <Polyline Points="50,50 75,30 100,100 130,40" Stroke="Red" StrokeThickness="20" StrokeStartLineCap="Triangle" StrokeEndLineCap="Triangle" Grid.Row="4" Grid.Column="4"/>
This example is part of a larger sample; for the complete sample, see Shape Elements Sample.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Note