CRichEditCtrl::LineIndex
줄이 내의 문자 인덱스 검색 CRichEditCtrl 개체입니다.
int LineIndex(
int nLine = -1
) const;
매개 변수
- nLine
편집 컨트롤의 텍스트에는 줄의 인덱스 값 또는-1이 들어.경우 nLine – 1 이며 현재 캐럿이 있는 줄, 즉 줄을 지정 합니다.
반환 값
지정 된 줄의 문자 인덱스 nLine 또는 지정한 줄 번호 크면-1 다음 편집 컨트롤의 줄 수입니다.
설명
문자 인덱스 rich edit 컨트롤의 시작 부분에서 문자를 지정 된 줄 수입니다.
자세한 내용은 EM_LINEINDEX 에 있는 Windows SDK.
예제
// The string for replacing.
LPCTSTR lpszmyString = _T("Hello, I'm the new second line.");
int nBegin, nEnd, nIndex;
// Replace the second line, if it exists, of the rich edit control
// with the text lpszmyString.
nIndex = m_myRichEditCtrl.LineIndex(1);
if ((nBegin = nIndex) != -1)
{
nEnd = nBegin + m_myRichEditCtrl.LineLength(nIndex);
m_myRichEditCtrl.SetSel(nBegin, nEnd);
m_myRichEditCtrl.ReplaceSel(lpszmyString);
}
요구 사항
헤더: afxcmn.h