TextBoxBase.CaretBrush 属性


获取或设置用于绘制文本框的插入符号的画笔。Gets or sets the brush that is used to paint the caret of the text box.

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


用于绘制文本框的插入符号的画笔。The brush that is used to paint the caret of the text box.


下面的示例创建一个TextBox并添加文本 "这是一些文本"。The following example creates a TextBox and adds the text, "This is some text." 此示例将的CaretBrushForeground属性TextBox设置为蓝色。The example sets the CaretBrush and Foreground properties of a TextBox to blue.

<TextBox SelectionBrush="Red" SelectionOpacity="0.5"
         Foreground="Blue" CaretBrush="Blue">  
  This is some text.

前面的示例生成类似于下图的输出。The preceding example produces output that is like the following illustration.

CaretBrush 设置为蓝色的 TextBox。TextBox with CaretBrush set to blue.
CaretBrush 设置为蓝色的 TextBoxTextBox with CaretBrush set to blue