如何在Edit编辑框中,累加的输入文字? 如何在Edit编辑框中,累加的输入文字?例如:点击一个按钮显示“第一个”。点击另外一个按钮显示“第二个”,但显示这个文字的时候,上次点击的文字保留在框内不变。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void CMyLogEditDlg::OnButton1() { // TODO: Add your control notification handler code here CString str; GetDlgItem(IDC_EDIT3)->GetWindowText(str); str += "第一个"; SetDlgItemText(IDC_EDIT3,str);}void CMyLogEditDlg::OnButton3() { // TODO: Add your control notification handler code here CString str; GetDlgItem(IDC_EDIT3)->GetWindowText(str); str += "第二个"; SetDlgItemText(IDC_EDIT3,str);} void CMyLogEditDlg::OnButton1() { // TODO: Add your control notification handler code here Updatedata(); CString str; GetDlgItem(IDC_EDIT3)->GetWindowText(str); str += "第一个"; SetDlgItemText(IDC_EDIT3,str);}void CMyLogEditDlg::OnButton3() { // TODO: Add your control notification handler code here Updatedata(); CString str; GetDlgItem(IDC_EDIT3)->GetWindowText(str); str += "第二个"; SetDlgItemText(IDC_EDIT3,str);} 我倒没仔细看你用CLASSWIZARD把控件和变量绑定一下啊然后使用前UPDATEDATA就哦了 通用点的:EditAddTail(CEdit* pEdit, LPCTSTR pszText, BOOL bRedo, BOOL bNewLine){ ASSERT(pEdit && IsWindow(pEdit->GetSafeHwnd()); if (!(pEdit && IsWindow(pEdit->GetSafeHwnd())) return; int nLength = pEdit->GetWindowTextLength(); pEdit->SetSel(nLength, nLength); pEdit->ReplaceSel(pszText, bRedo); if (bNewLine) { pEdit->ReplaceSel(_T("\r\n")); }} GDI的Alphablend函数让底色实现不同的透明度呢??? 求救!!!关于MFC中的BSTR参数如何调用问题,在线等 怎样在Microsoft Project 的Toolbar 里增加功能以及图标 列表视图控件的列可以画图吗? 怪事年年有今年特别多,,求教 FLASH是如何判断播放是否完成 一个用来发送和接受消息的socket,如何判断他能被新的连接用。 大侠!有谁知道怎么获取由js创建产生链接吗? 请教下,滚动条滚动的时候,控件滚到一半该怎么处理的 急!急!急!急!怎么自定义edit控件的右键菜单?? 求MFC中Unicode字符串操作(分析网页数据用)最高效的方法 相对路径的问题
{
// TODO: Add your control notification handler code here
CString str;
GetDlgItem(IDC_EDIT3)->GetWindowText(str);
str += "第一个";
SetDlgItemText(IDC_EDIT3,str);
}void CMyLogEditDlg::OnButton3()
{
// TODO: Add your control notification handler code here
CString str;
GetDlgItem(IDC_EDIT3)->GetWindowText(str);
str += "第二个";
SetDlgItemText(IDC_EDIT3,str);
}
{
// TODO: Add your control notification handler code here
Updatedata();
CString str;
GetDlgItem(IDC_EDIT3)->GetWindowText(str);
str += "第一个";
SetDlgItemText(IDC_EDIT3,str);
}void CMyLogEditDlg::OnButton3()
{
// TODO: Add your control notification handler code here
Updatedata();
CString str;
GetDlgItem(IDC_EDIT3)->GetWindowText(str);
str += "第二个";
SetDlgItemText(IDC_EDIT3,str);
}
你用CLASSWIZARD把控件和变量绑定一下啊
然后使用前UPDATEDATA就哦了
EditAddTail(CEdit* pEdit, LPCTSTR pszText, BOOL bRedo, BOOL bNewLine)
{
ASSERT(pEdit && IsWindow(pEdit->GetSafeHwnd());
if (!(pEdit && IsWindow(pEdit->GetSafeHwnd()))
return;
int nLength = pEdit->GetWindowTextLength();
pEdit->SetSel(nLength, nLength);
pEdit->ReplaceSel(pszText, bRedo);
if (bNewLine)
{
pEdit->ReplaceSel(_T("\r\n"));
}
}