The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PenLineCap Enumeration

Describes the shape at the end of a line or segment.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

Public Enumeration PenLineCap
Dim instance As PenLineCap

public enum PenLineCap
public enum PenLineCap
<object property="EnumerationValue" .../>

 Member nameDescription
FlatA cap that does not extend past the last point of the line. Comparable to no line cap. 
RoundA semicircle that has a diameter equal to the line thickness.  
SquareA rectangle that has a height equal to the line thickness and a length equal to half the line thickness.  
TriangleAn equilateral triangle whose sides are equal in length to the thickness of the line.  

The following illustration shows the available cap styles for lines or segments. The red portion of the line shows the extra area added by the line cap setting.

Line caps

PenLineCap settings

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.


This property only affects an open shape, such as a Line, a Polyline, or an open Path element.

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 Grid.Column="3" Grid.Row="1">Flat</TextBlock>
  Points="50,50 75,30 100,100 130,40"
  Grid.Row="1" Grid.Column="4"/>

<TextBlock Grid.Column="3" Grid.Row="2">Square</TextBlock>
  Points="50,50 75,30 100,100 130,40"
  Grid.Row="2" Grid.Column="4"/>

<TextBlock Grid.Column="3" Grid.Row="3">Round</TextBlock>
  Points="50,50 75,30 100,100 130,40"
  Grid.Row="3" Grid.Column="4"/>

<TextBlock Grid.Column="3" Grid.Row="4">Triangle</TextBlock>
  Points="50,50 75,30 100,100 130,40"
  Grid.Row="4" Grid.Column="4"/>

This example is part of a larger sample; for the complete sample, see Shape Elements Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft