void CeditdemoDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
CString str1;
SetDlgItemText(IDC_EDIT1, _T(""));
for (int i = 0; i < 5; i++)
{
((CEdit*)GetDlgItem(IDC_EDIT1))->SetSel(GetDlgItem(IDC_EDIT1)->GetWindowTextLength(), GetDlgItem(IDC_EDIT1)->GetWindowTextLength());
str1.Format(_T("AAAAA%d"), i);
((CEdit*)GetDlgItem(IDC_EDIT1))->ReplaceSel(str1 + L"\n");
}
}
void CeditdemoDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
CString content, str1;
SetDlgItemText(IDC_EDIT1, _T(""));
for (int i = 0; i < 5; i++)
{
GetDlgItemText(IDC_EDIT1, content);
str1.Format(_T("AAAAA%d;"), i);
content += str1;
content += "\r\n\r\n";
SetDlgItemText(IDC_EDIT1, content);
}
}
按钮1;
按钮2;
设置编辑框 Multilines、Vertical Scroll、Want return 三个属性为true;