怎样获取 edit控件读取每行信息的字符个数
1个回答
展开全部
m_Edit.GetLine(0,lpszBuffer);//读取edit控件中第一行文本存入lpszBuffer指向的字符串中,m_Edit是与edit控件关联的变量
可参考代码:
int i, nLineCount = m_myEdit.GetLineCount();//m_myEdit是与edit控件关联的变量
CString strText, strLine;
// Dump every line of text of the edit control.
for (i=0; i < nLineCount; i++)
{
// length of line i:
int len = m_myEdit.LineLength(m_myEdit.LineIndex(i));
m_myEdit.GetLine(i, strText.GetBuffer(len), len);
strText.ReleaseBuffer(len);
strLine.Format(_T("line %d: '%s'\n"), i, strText);
AFXDUMP(strLine);//输出得到的每行数据
}
可参考代码:
int i, nLineCount = m_myEdit.GetLineCount();//m_myEdit是与edit控件关联的变量
CString strText, strLine;
// Dump every line of text of the edit control.
for (i=0; i < nLineCount; i++)
{
// length of line i:
int len = m_myEdit.LineLength(m_myEdit.LineIndex(i));
m_myEdit.GetLine(i, strText.GetBuffer(len), len);
strText.ReleaseBuffer(len);
strLine.Format(_T("line %d: '%s'\n"), i, strText);
AFXDUMP(strLine);//输出得到的每行数据
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询