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 會傳回實體行的第一個字元索引。 實體線是顯示的行,而不是指派的行。 顯示行的數目可以大於因為換行而指派的行數。 例如,如果您將兩條長行指派給 RichTextBox 控制項並設定 Multiline 為 , WordWraptrue 則兩個長指派的行會產生四個實體 (或顯示行) 。

適用於

另請參閱