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 設定為 blue 的 TextBox。TextBox with CaretBrush set to blue.
CaretBrush 設為 blue 的 TextBoxTextBox with CaretBrush set to blue