Pen.DashStyle 屬性

定義

取得或設定值,這個值描述由這個 Pen 產生之虛線的圖樣。

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

屬性值

一個值,這個值描述由這個 Pen 產生之虛線的圖樣。 預設為 Solid,表示不應有虛線。

範例

下列範例示範如何使用 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>

備註

類別 DashStyles 提供一組預先定義的虛線圖樣。

相依性屬性資訊

識別碼欄位 DashStyleProperty
中繼資料屬性設定為 true

適用於

另請參閱