我得问题是这样的:
我在Dialog上插入了一个RichEdit控件m_EditPan,但是我在代码中控制输入,比如我写一个函数,m_EditPan.Write ( ... ),它就把我写的参数,写到了控件框中,并且自动换行。
请问谁知道,提示一下。谢谢
我在Dialog上插入了一个RichEdit控件m_EditPan,但是我在代码中控制输入,比如我写一个函数,m_EditPan.Write ( ... ),它就把我写的参数,写到了控件框中,并且自动换行。
请问谁知道,提示一下。谢谢
解决方案 »
- MFC中如何用双缓冲实现页面无闪烁问题
- 有趣的现象,大家来看看.
- 把vc6.0的工程转换到vc2005后,找不到包含的头文件afxwin.h
- 学生专用工作搜索引擎,支持分组语音群聊
- debag编译能通过,release编译通不过
- 如何得到光盘或磁盘未插入的系统信息,急用!!!
- HDC与HBITMAP问题
- Windows NT Timer 10ms 是如何做到的?
- 新手求教,MFC中CDC::FillRect()函数中的参数问题
- 怎样区别一光碟是 CD盘还是 VCD盘?
- 问个小问题?
- 300分求解一个问题:我自己编写了一个函数用于将.ico文件和我自己的程序关联起来,可是我不想改变默认的图标显示,请问应如何处理?
str1+=stradd;
SetDlgItemText(控件ID ,str1);
{
CString WindowText; m_EditPan.GetWindowText( WindowText ); WindowText += iText; m_EditPan.SetWindowText( WindowText );
}
有效吗?不行吧!他不会换行,而是直接显示“\r\n”。
rRichEdit.SetSel(l, l);
rRichEdit.ReplaceSel(_T(“帮助\r\n”));
用ReplaceSel
DWORD CALLBACK CMainFrame::StreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CFile* pFile = (CFile*) dwCookie;
*pcb = pFile->Read(pbBuff, cb);
return 0;
}
BOOL CMainFrame::Write(CString strMsg)
{
char str[10]="123456789";
CFile cFile(TEXT("record.txt"), CFile::modeWrite);
cFile.Seek(0,CFile::end);
//添加时间
CTime time = CTime::GetCurrentTime();
CString strTime = time.Format("%H:%M:%S");
strTime += TEXT(" ");
strTime += strMsg;
strMsg = strTime;
//添加回车
char cc = '\n';
strMsg+=cc; cFile.Write(strMsg.GetBuffer(strMsg.GetLength()),strMsg.GetLength());
cFile.Close();
//输出到RichEdit
EDITSTREAM es;
cFile.Open(TEXT("record.txt"), CFile::modeRead);
es.dwCookie = (DWORD)&cFile;
es.pfnCallback = StreamInCallback;
m_EditPan.StreamIn(SF_TEXT, es);
cFile.Close();
return TRUE;
}
m_EditPan.Create(WS_CHILD|WS_VISIBLE|ES_AUTOVSCROLL|ES_WANTRETURN|
ES_AUTOVSCROLL|ES_MULTILINE|ES_READONLY,
CRect(0,0,100,100),&m_wndView,1);