TextBox.TextDecorations TextBox.TextDecorations TextBox.TextDecorations TextBox.TextDecorations Property

定义

获取要应用到文本框的文本修饰。Gets the text decorations to apply to the text box.

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 集合,它包含应用于文本框的文本修饰。A TextDecorationCollection collection that contains text decorations to apply to the text box. 默认值为 null(不应用任何文本修饰)。The default is null (no text decorations applied).

示例

下面的示例演示如何使用TextDecorations Run作为示例元素来设置特性。The following example shows how to set the TextDecorations attribute, using Run as the example element.

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

下图显示了此示例的呈现效果。The following figure shows how this example renders.

图具有默认删除线效果Screenshot: Text with default strikethrough effect

下图显示了、 OverLine BaselineUnderline修饰的分别呈现方式。The following figures show how the OverLine, Baseline, and Underline decorations render, respectively.

![图上划线]TextDecorator(~/add/media/inline-textdec-over.png "屏幕快照:上划线 TextDecorator")Screenshot: Overline TextDecorator

![图]文本(~/add/media/inline-textdec-base.png "屏幕截图上的默认基线效果:文本上的默认基线效果")Screenshot: Default baseline effect on text

图带有默认下划线效果Screenshot: Text with default underline effect

下面的示例演示如何以编程方式TextDecorations设置属性。The following example shows how to set the TextDecorations property programmatically.

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对象是可添加到文本的视觉对象装饰。A TextDecoration object is a visual ornamentation you can add to text. 有四种类型的文本修饰: 下划线、基线、删除线和上划线。There are four types of text decorations: underline, baseline, strikethrough, and overline. 有关文本修饰的详细信息, 请参阅如何:创建文本修饰For more information about text decorations, see How to: Create a Text Decoration.

依赖项属性信息Dependency Property Information

标识符字段Identifier field TextDecorationsProperty
元数据属性设置为trueMetadata properties set to true AffectsRender

适用于