Inline.TextDecorations 屬性

定義

取得 TextDecorationCollection,包含要套用至這個項目的文字裝飾。

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

屬性值

TextDecorationCollection

TextDecorationCollection 集合,包含要套用至這個項目的文字裝飾。

預設值為 null , (未套用任何文字裝飾) 。

範例

下列範例示範如何設定 TextDecorations 專案的屬性 Inline (Run) 。

<FlowDocument ColumnWidth="200">
  <Paragraph>
    <Run TextDecorations="Strikethrough">
      This text will render with the strikethrough effect.
    </Run>
  </Paragraph>
</FlowDocument>

下圖顯示此範例的轉譯方式。

螢幕擷取畫面:套用預設刪除線效果的文字

下圖顯示 覆線基準底線 裝飾如何分別呈現。

螢幕擷取畫面:頂線 TextDecorator

螢幕擷取畫面:對文字套用的預設基準線效果

螢幕擷取畫面:套用預設底線效果的文字

下列範例示範如何以程式設計方式設定 TextDecorations 屬性。

Run run1 = new Run("This text will render with the strikethrough effect.");
run1.TextDecorations = TextDecorations.Strikethrough;
Dim run1 As New Run("This text will render with the strikethrough effect.")
run1.TextDecorations = TextDecorations.Strikethrough

備註

TextDecoration物件是您可以新增至文字的視覺裝飾。 文字裝飾有四種類型:底線、基準、刪除線和超線。 如需文字裝飾的詳細資訊,請參閱 如何:建立文字裝飾

相依性屬性資訊

識別碼欄位 TextDecorationsProperty
設定為 的中繼資料屬性 true AffectsRender

適用於