TextBox.TextDecorations 屬性

定義

取得要套用至文字方塊的文字裝飾。

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 集合。 預設值為 null (不套用文字裝飾)。

範例

下列範例示範如何使用 做為範例專案來 Run 設定 TextDecorations 屬性。

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

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

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

下圖顯示 、 BaselineUnderline 裝飾如何 OverLine 分別呈現。

螢幕擷取畫面:超線 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

適用於