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
Solved

MFC

Posted on 2000-04-01
2
1,043 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
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
kkarunakar earned 25 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to event 3 102
What is MicroStrategy.NET? 2 70
How can my static class become undefined?? 8 62
C# LINQ ForEach() question 6 54
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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…

856 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