用CEditView建立了单文档,添加了一个菜单,插入当前时间,代码如下:
COleDateTime myTime = COleDateTime::GetCurrentTime();
CString strTime = myTime.Format(_T("%Y-%m-%d %H:%M:%S"));
pDC->TextOut(100,100,strTime);
好象在这里不能用TextOut的,怎么搞啊,还有我想随便什么位置输入时间啊。
COleDateTime myTime = COleDateTime::GetCurrentTime();
CString strTime = myTime.Format(_T("%Y-%m-%d %H:%M:%S"));
pDC->TextOut(100,100,strTime);
好象在这里不能用TextOut的,怎么搞啊,还有我想随便什么位置输入时间啊。
dc.textout(...)
...
...
textout()不能用于文档
CEdit& theEdit = GetEditCtrl();
theEdit.ReplaceSel(strTime)如果菜单响应函数是在如果是其他类里则要先得到CEditView类。再使用。