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)
原文地址:https://www.cnblogs.com/cutepig/p/1639469.html