通过


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

属性值

当前文本选择字符串中第一个字符的从零开始的索引。

属性

例外

该值小于零。

注解

如果未在控件中选择任何文本,则此属性指示新文本的插入点。 如果将此属性设置为超出控件中文本长度的位置,则选择开始位置位于最后一个字符之后。 在文本框控件中选择文本时,更改此属性可以释放该属性的值 SelectionLength 。 如果该属性指示 SelectionStart 的位置小于属性的值 SelectionLength 之后控件中的剩余文本,则属性的值 SelectionLength 将自动减少。 属性的值 SelectionStart 永远不会导致属性增加 SelectionLength

注释

SelectionStart 返回当前所选内容的较低值。 例如, Select(10, -4) 从字符位置 6 到字符位置 10 中选择文本。 如果现在获取 SelectionStart 该值,则该值将为 6 而不是 10。

适用于

另请参阅