Share via


ComboBox.SelectionStart 屬性

定義

取得或設定下拉式方塊中所選取文字的起始索引。

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

屬性值

Int32

在目前文字選取的字串中第一個字元之以零為起始的索引。

屬性

例外狀況

這個值小於零。

備註

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

注意

SelectionStart 會傳回目前選取範圍的較低值。 例如, Select(10, -4) 從字元位置 6 到字元位置 10 選取文字。 如果您現在取得 SelectionStart 值,則此值會是 6,而不是 10。

適用於

另請參閱