Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MFC

Posted on 2000-04-01
2
Medium Priority
?
1,057 Views
Last Modified: 2013-11-25

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 ?
0
Comment
Question by:r_sam_14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
kkarunakar earned 75 total points
ID: 2676198
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
kkarunakar@hotmail.com
0
 
LVL 1

Expert Comment

by:kkarunakar
ID: 2684496
Hi Sam
I am fine and hope same to u. I will try my best to answer ur queries and hope u will get more clear figure.
WM_PAINT is a message .So frame work has to send it to the control or parent. For that we need to map the message and thus ON_WM_PAINT message come to existance. But for OnDraw () as I told u earlier also it is not message like WM_PAINT and tell u when it is called.
It is a virtual function and class or object has to overide this function to draw itself. So whenever document want to print or print priview it ..It just calls OnDraw() with specfic CDC Object and and draw itself.
Now I think u r doubt is more clear..
Regards keshav..
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question