Export (0) Print
Expand All

Shape.StrokeStartLineCap Property

Gets or sets a PenLineCap enumeration value that describes the Shape at the start of a Stroke.

Namespace: System.Windows.Shapes
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public PenLineCap StrokeStartLineCap { get; set; }
/** @property */
public PenLineCap get_StrokeStartLineCap ()

/** @property */
public void set_StrokeStartLineCap (PenLineCap value)

public function get StrokeStartLineCap () : PenLineCap

public function set StrokeStartLineCap (value : PenLineCap)

<object StrokeStartLineCap="PenLineCap" .../>

Property Value

One of the PenLineCap enumeration values. The default is Flat.

This property has no effect if you set it on a shape that has no Stroke or that has no start or end points. For example, this property has no effect if you set it on an Ellipse.

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.

NoteNote:

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>
<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.

More Code

How to: Draw a Polyline by Using the Polyline Element

This example shows how to draw a polyline, which is a series of connected lines, by using the Polyline element.

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

Community Additions

ADD
Show:
© 2014 Microsoft