视图类文字显示问题 应用程序视图类继承自CEditView,想显示程序接收的信息,或者其他的错误提示等。要求能实现自动滚屏。不想用TextOut(),要算坐标,因为有时候不知道信息有几行;请告知各种实现的方法!谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CEdit& edit = GetEditCtrl();edit.SetSel(-1, -1);edit.Replace("your text"); CEdit& edit = GetEditCtrl();edit.SetSel(-1, -1);edit.ReplaceSel("your text"); 参照我给的一段代码:CEdit& theEdit = GetEditCtrl();DWORD dwMargins = theEdit.GetMargins();theEdit.SetMargins(20, HIWORD(dwMargins));theEdit.SetLimitText(10 * 1024);int nLine;CString strTmp,strText;MSG msg;for(int i=0;i<1000;i++){ while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } strTmp.Format(_T("%d\r\n"),i*i); strText+=strTmp; theEdit.SetWindowText(strText); nLine=theEdit.GetLineCount(); theEdit.LineScroll(nLine);} 谢谢兄弟们!我已经弄好了! CEdit& TempEdit = ((CSMSTranView*)((CMainFrame*)AfxGetApp()->GetMainWnd())->GetActiveView())->GetEditCtrl(); TempEdit.SetSel(TempEdit.GetSel()); TempEdit.ReplaceSel(lpszText); CFormView中控件初始化的问题? 关于读取内存的问题 怎么判断某个目录下某个文件是否存在? MFC里怎么实现list control收缩展开呢?(急在线等) 我把activex放在system32下regsvr32说loadlibrary失败 想跳了,很迷茫,请各位为在下指条明路 郁闷:哪些情况要UpdateData(TRUE)?它的具体意思是什么? vc串口读取信号问题 再散100分,恭喜一个星期从两个角变成三个角 求救高手!VC中如何实现使CSplitterWnd中的分割条变成平面的,并且改变颜色? ComboBox如何使用? 对vc数据库客户端软件编程的一点总结!
edit.SetSel(-1, -1);
edit.Replace("your text");
edit.SetSel(-1, -1);
edit.ReplaceSel("your text");
theEdit.SetMargins(20, HIWORD(dwMargins));
theEdit.SetLimitText(10 * 1024);
int nLine;
CString strTmp,strText;
MSG msg;
for(int i=0;i<1000;i++)
{
while(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
strTmp.Format(_T("%d\r\n"),i*i);
strText+=strTmp;
theEdit.SetWindowText(strText);
nLine=theEdit.GetLineCount();
theEdit.LineScroll(nLine);
}
我已经弄好了!
CEdit& TempEdit = ((CSMSTranView*)((CMainFrame*)AfxGetApp()->GetMainWnd())->GetActiveView())->GetEditCtrl();
TempEdit.SetSel(TempEdit.GetSel());
TempEdit.ReplaceSel(lpszText);