TextBoxBase.GetFirstCharIndexFromLine(Int32) 方法

定义

检索给定行的第一个字符的索引。

public:
 int GetFirstCharIndexFromLine(int lineNumber);
public int GetFirstCharIndexFromLine(int lineNumber);
member this.GetFirstCharIndexFromLine : int -> int
Public Function GetFirstCharIndexFromLine (lineNumber As Integer) As Integer

参数

lineNumber
Int32

要为其获取其第一个字符索引的行。

返回

指定行中第一个字符的从零开始的索引。

例外

参数的值 lineNumber 小于零。

注解

文本框中的行号从零开始。 lineNumber如果参数大于文本框中的最后一行,GetFirstCharIndexFromLine则返回 -1。

GetFirstCharIndexFromLine 返回物理行的第一个字符索引。 物理行是显示的行,而不是分配的行。 显示的行数可以大于由于换行而分配的行数。 例如,如果将两条长线分配给控件并设置RichTextBoxMultiline赋值WordWrap,则两个长赋值行会导致四个true物理行(或显示行)。

适用于

另请参阅