語言

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加上文字「This is some text.」範例中將 a CaretBrush 的 和 Foreground 屬性設TextBox為藍色。

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

前述範例產生的輸出與以下圖示相似。

TextBox 搭配 CaretBrush 設定為藍色。 TextBox 搭配 CaretBrush 藍色

適用於