Pen.StartLineCap Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the type of shape to use at the beginning of a stroke.

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

public PenLineCap StartLineCap { get; set; }

Property Value

Type: System.Windows.Media.PenLineCap

The type of shape that starts the stroke. The default value is Flat.

Identifier field

StartLineCapProperty

Metadata properties set to true

None

The following example shows how to use the StartLineCap and EndLineCap properties to create a rounded end on one side of a stroke and a triangular end on the other side of the stroke.

<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel Margin="20">

    <Canvas Margin="100"  Width="100" Height="100">
      <Canvas.Background>
        <DrawingBrush>
          <DrawingBrush.Drawing>
            <GeometryDrawing>
              <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="10,10" EndPoint="50,100" />
              </GeometryDrawing.Geometry>
              <GeometryDrawing.Pen>

                <!-- This Pen specifies a round line cap at the beginning of
                     the line and a triangular line cap at the end of the line. -->
                <Pen Brush="Blue" Thickness="8"  StartLineCap="Round" 
                     EndLineCap="Triangle" />
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Canvas.Background>
    </Canvas>

  </StackPanel>

</Page>

.NET Framework
Available since 3.0
Return to top
Show: