BCGSoft Professional Editor for MFC
int CBCGPEditCtrl::LineFromChar ( int  nIndex) const

Retrieves the number of the line that contains the specified character index.

Returns
The zero-based number of the line containing the character index specified by nIndex. If nIndex is -1, the number of the line that contains the first character of the selection is returned. If there is no selection, the current line number is returned.

Call this function to retrieve the number of the line that contains the specified character index. A character index is the number of characters from the beginning of the edit control.

Parameters
nIndexContains the zero-based index value for the desired character in the text of the edit control, or contains -1. If nIndex is -1, it specifies the current line, that is, the line that contains the caret.