15,979
社区成员
发帖
与我相关
我的任务
分享
// The string for replacing.
CString strString(_T("Hi, we're the replacements."));
int nBegin, nEnd;
// Replace the last line, if it exists, of the edit control
// with the text strString.
int nLastLine = m_myEdit.GetLineCount()-1;
if ((nBegin = m_myEdit.LineIndex(nLastLine)) != -1)
{
nEnd = nBegin + m_myEdit.LineLength(nBegin);
m_myEdit.SetSel(nBegin, nEnd);
m_myEdit.ReplaceSel(strString);
}