建立一个最简单的单文档工程在题目中提到的函数WinApp::OnPaint()\WinMainFrame::OnPaint()\WinView::OnPaint()\WinView::OnDraw()中加入
(OnPaint()对应于各个类添加的WM_PAINT消息,OnDraw()是WinView原有的) CString cx("hello,MFC");
CRect rect;
GetClientRect(&rect);
pDC->SetTextAlign(TA_CENTER);
pDC->TextOut(rect.right/2,rect.bottom/2,cx);只有WinView::OnDraw()看得到显示在文本框里。
这些函数有什么区别为什么会这样?
(OnPaint()对应于各个类添加的WM_PAINT消息,OnDraw()是WinView原有的) CString cx("hello,MFC");
CRect rect;
GetClientRect(&rect);
pDC->SetTextAlign(TA_CENTER);
pDC->TextOut(rect.right/2,rect.bottom/2,cx);只有WinView::OnDraw()看得到显示在文本框里。
这些函数有什么区别为什么会这样?
解决方案 »
- 新手提问:帮忙测试一下代码,VC用ADO连接oracle数据库的
- 请问超简单的送分问题,关于类成员访问
- 开发EMAIL客户端的探讨!!!!!高分相送!!!!!!!!!
- 为什么我创建了一块透明的长方形,然后给这个长方形加颜色,整个场景都受这个颜色的影响,这快透明的材质简直就是一个光源,妈的,我都疯
- 字符的简单问题!! 转换的问题!
- 短整型,整型和单精度浮点型的运算速度差多少?
- 在编写vc++时弹出什么什么内存不能为read
- installshield问题。
- 如何在自己的程序通过Internet发手机短消息
- send 和 post的区别是什么?谢谢
- 一个虚函数问题,VC编译通不过,高手进来看看,//***处标记
- 怎样重画整个窗口?
This method is called by the framework to render an image of the document. The framework calls this method to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.
CWnd::OnPaint
The framework calls this member function when Windows or an application makes a request to repaint a portion of an application's window.
添加到其他函数都没用只有加到OnDraw()中才有显示.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_88ac.asp
学校的网太烂,上不了MSDN,麻烦mscf(扎西特勒)兄把那篇文章发到
[email protected]
谢谢。