共用方式為


CRichEditCtrl::GetLineCount

擷取的行數。 CRichEditCtrl 物件的。

int GetLineCount( ) const;

傳回值

行數。這 CRichEditCtrl 物件的。

備註

如需詳細資訊,請參閱 Windows SDK的 EM_GETLINECOUNT

範例

int nLineLength, nLineIndex, nLineCount = m_myRichEditCtrl.GetLineCount();
CString strText, strLine;

// Dump every line of text of the rich edit control.
for (int i = 0; i < nLineCount; i++)
{
   nLineIndex = m_myRichEditCtrl.LineIndex(i);
   nLineLength = m_myRichEditCtrl.LineLength(nLineIndex);
   m_myRichEditCtrl.GetLine(i, strText.GetBufferSetLength(nLineLength + 1),
      nLineLength);
   strText.SetAt(nLineLength, _T('\0')); // null terminate
   strText.ReleaseBuffer(nLineLength + 1);

   TRACE(_T("line %d: '%s'\r\n"), i, strText);
}

需求

Header: afxcmn.h

請參閱

參考

CRichEditCtrl 類別

階層架構圖

CRichEditCtrl::GetLine