言語

DashStyle.Dashes プロパティ

定義

この DashStyleのダッシュとギャップのコレクションを取得または設定します。

public:
 property System::Windows::Media::DoubleCollection ^ Dashes { System::Windows::Media::DoubleCollection ^ get(); void set(System::Windows::Media::DoubleCollection ^ value); };
public System.Windows.Media.DoubleCollection Dashes { get; set; }
member this.Dashes : System.Windows.Media.DoubleCollection with get, set
Public Property Dashes As DoubleCollection

プロパティ値

ダッシュとギャップのコレクション。 既定値は空の DoubleCollectionです。

次の例は、DashStylePen プロパティを使用して、テキストの下に破線を作成する方法を示しています。

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

    <TextBlock FontSize="36">
      the lazy brown dog.
      <TextBlock.TextDecorations>
        <TextDecoration Location="Underline"  
          PenThicknessUnit="FontRecommended">
          <TextDecoration.Pen>
            <Pen Thickness="1.5" Brush="Red" >

              <!-- For the underline, create a dashed line with each
                   dash twice the thickness of the Pen and each gap 8 times
                   the thickness of the Pen. -->
              <Pen.DashStyle>
                <DashStyle Dashes="2,8"/>
              </Pen.DashStyle>
            </Pen>
          </TextDecoration.Pen>
        </TextDecoration>
      </TextBlock.TextDecorations>
    </TextBlock>
  </StackPanel>
</Page>

注釈

このコレクションは、交互のダッシュとギャップの長さを表します。 コレクション内の値は、ThicknessPenの倍数の観点から見た値です。 たとえば、 1,2 の配列は、長さのダッシュ (1 * Thickness) の後に長さのギャップ (2 * Thickness) を指定します。

Note

描画されるダッシュの実際の長さは、ダッシュの各端に追加される DashCap のスタイルによって異なります。 DashCapの既定のPen値はSquareです。 これにより、線の半分の太さのエンド キャップがペン ストロークの各端に追加されます。 (例については、 PenLineCap を参照してください)。したがって、 02 、および正方形の DashCapの配列を指定すると、実際のダッシュの長さは (0 * Thickness) + (2 * DashCap) になります。

コレクション内に奇数の値がある場合、値は、偶数の値を生成するために 1 回繰り返されたかのように解釈されます。 たとえば、 235 を含むコレクションは、 235235を含むコレクションと同じように解釈されます。

配列内の負の値は、その絶対値として解釈されます。

依存関係プロパティ情報

品目 価値
識別子フィールド DashesProperty
に設定されたメタデータ プロパティ true None

適用対象