共用方式為


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 (未施加文字裝飾)。

範例

下列示範以 Paragraph 做為範例元素,說明如何設定 Typography 屬性。

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

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

截圖:文字帶有預設劃線效果

以下圖表分別展示了 、 BaselineUnderline 裝飾的渲染方式OverLine

截圖:Overline TextDecorator

截圖:文字預設基線效果

截圖:帶有預設底線效果

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

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

適用於