TextBox.SelectionStart 属性

定义

获取或设置当前选择的起始位置的字符索引。Gets or sets a character index for the beginning of the current selection.

public:
 property int SelectionStart { int get(); void set(int value); };
public int SelectionStart { get; set; }
member this.SelectionStart : int with get, set
Public Property SelectionStart As Integer

属性值

当前选择的起始位置的字符索引。The character index for the beginning of the current selection.

异常

SelectionStart 设置为一个负值。SelectionStart is set to a negative value.

注解

如果指定的选择长度将导致选定内容在回车符和换行字符之间结束, 则选择长度会自动增加 1, 使所得到的选择跨越整个行尾标记。In cases where the specified selection length would cause the selection to end between a carriage return and a new-line character, the selection length is automatically increased by 1 so that the resulting selection spans the entire end-of-line marker.

适用于

另请参阅