|
Question : MFC
|
|
We use ON_WM_PAINT() macro to invoke the handler OnPaint(),similarly we use OnDraw(CDC *pDC) which the MFC frame work calls , what is the basic difference between these to calls ?
|
|
Answer : MFC
|
|
Hi There, I am keshav here from india. I am trying to reply to ur question. Pls do inform ur comment on this. I will discuss this taking two case.. 1.OnDraw():- This is method defined in CView,COleControl,CComControl and all related view class. And OnPaint() is called for class derived from CWnd. Like ur all controls.Frame work call this method with giving CDC object to the window to draw it self. And Frame work calls CDraw to invalidate any drawing for corresponding document of view.This is called for prinnt,print preview and screen display with given CDC object. So u can uderstand the difference. 2. I will give u with example of ActiveX control. The control class of activex contrl has both the functions. OnPaint() and OnDraw(). Framework call OnDraw() function when ur control is in design mode.Since it can't invalidate the window since container is not running.. But Frame work calls OnPaint when container is running and this OnPaint calls OnDraw() with given CDC object. Hope My answer will make ur doubt clear.. Regards. Keshav karunakar [email protected]
|
|
|
|