共用方式為


ToolStripTextBox.SelectionLength 屬性

定義

取得或設定 中 ToolStripTextBox所選字元的數量。

public:
 property int SelectionLength { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int SelectionLength { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionLength : int with get, set
Public Property SelectionLength As Integer

屬性值

選取的 ToolStripTextBox字元數。

屬性

備註

你可以利用這個特性判斷文字框控制中目前是否有任何字元被選取,然後再對所選文本執行操作。 當屬性的值SelectionLength被設定為大於控制項文字中字元數的值時,屬性的值SelectionLength會設定為控制項內整個文字長度減去屬性SelectionStart值(如果屬性有指定值)。SelectionStart

備註

你可以透過程式化地在文字框內移動插入點,方法是將 設定 SelectionStart 為你想讓插入點移動的位置,並將屬性設 SelectionLength 為零(0)。 文字框必須有焦點,才能讓插入點被移動。

適用於

另請參閱