ToolStripTextBox.SelectionStart 屬性

定義

取得或設定 ToolStripTextBox 中所選文字的起點。

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

屬性值

在 中 ToolStripTextBox 選取的文字開始位置。

屬性

備註

如果控制項中未選取任何文字,這個屬性會指出新文字的插入點。 如果您將此屬性設定為超出控制項中文字長度的位置,則選取範圍開始位置會放在最後一個字元之後。 在文字方塊控制項中選取文字時,變更此屬性可能會減少 屬性的值 SelectionLength 。 如果 屬性所指示 SelectionStart 的位置之後的其餘文字小於 SelectionLength 屬性值,則屬性的值 SelectionLength 會自動減少。 屬性的值 SelectionStart 永遠不會造成屬性增加 SelectionLength

注意

您可以透過程式設計方式移動文字方塊內的插入號,方法是將 設定 SelectionStart 為要移動插入號的文字方塊內的位置,並將 屬性設定 SelectionLength 為零 (0) 。 文字方塊必須有焦點,才能移動插入號。

適用於