语言

TextBoxBase.CaretBrush 属性

定义

获取或设置用于绘制文本框插入符号的画笔。

public:
 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

属性值

用于绘制文本框插入符号的画笔。

示例

以下示例创建并TextBox添加文本“这是一些文本”。该示例将 a CaretBrush to blue 的和Foreground属性设置为TextBox蓝色。

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

前面的示例生成如下图所示的输出。

将 CaretBrush 设置为蓝色的 TextBox。 将 CaretBrush 设置为蓝色的 TextBox

适用于