why Do not call CDialog/CWnd::OnPaint() for painting messages

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/b688fe19-8517-473e-9183-83289f650281 

Several things happen behind the scenes with CPaintDC. Its constructor calls BeginPaint, which issues an erase background message.  So creating two CPaintDC causes interference between them.  You can read about the BeginPaint/EndPaint APIs for more understanding of erasing and clipping.


If you want to paint in derived classes and base classes do it the way MFC does with CView.  Create the CPaintDC only one time and place and pass it by reference to descendant classes using something like OnDraw(CDC* pDC)

posted on 2010-01-05 10:35  cutepig  阅读(816)  评论(0编辑  收藏  举报

导航