次の方法で共有


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);
}

必要条件

**ヘッダー:**afxcmn.h

参照

参照

CRichEditCtrl クラス

階層図

CRichEditCtrl::GetLine

その他の技術情報

CRichEditCtrl のメンバー