次の方法で共有


方法 : 直線または線分の終点のキャップを変更する

更新 : 2007 年 11 月

この例では、開いた Shape 要素の始点または終点の形状を変更する方法を示します。開いた Shape の始点のキャップを変更するには、StrokeStartLineCap プロパティを使用します。開いた Shape の終点のキャップを変更するには、StrokeEndLineCap プロパティを使用します。使用できる線キャップを確認するには、PenLineCap 列挙体を参照してください。

ms754071.alert_note(ja-jp,VS.90).gifメモ :

このプロパティは、LinePolyline、または開いた Path 要素などの開いた図形に対してのみ適用されます。

次の例では、4 つの Polyline 要素を描画し、それぞれの端に異なる形状のセットを使用します。

使用例

<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"/>

この例は、より大きなサンプルの一部分です。サンプル全体については「Shape 要素のサンプル」を参照してください。

参照

参照

Polyline

PenLineCap