語言

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。

範例

以下範例展示了如何利用 DashStyle 的 Pen 屬性在文字下方建立虛線。

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

備註

此集合描述了交替破折號與空格的長度。 集合中的值以 的Thickness倍數Pen表示。 例如,一個陣1列 ,2指定一個長度為 (1 * Thickness) 的劃線,接著一個長度為 () 的空隙。2 * Thickness

Note

實際繪製的破折號長度取決於破折號兩端所加的樣式 DashCap 。 a DashCap 的預設Pen值為 Square。 這會導致筆劃兩端加一個厚度為線條一半的端蓋。 (請參見PenLineCap範例。)因此,若你指定一個陣列 ,以及一個正方形0,實際的劃線長度將是 (2DashCap0) + ( * Thickness2)。 * DashCap

若集合中有奇數個值,則將這些值解釋為重複一次,產生偶數個值。 例如,包含 2,35的集合與包含 2,35235 的集合被解釋為相同。

陣列中的負值會被解釋為其絕對值。

相依財產資訊

Item 價值觀
識別碼欄位 DashesProperty
元資料屬性設為 true None

適用於