when does OnDraw Func. gets Called
-
In the mfc application when does the Ondraw handler gets called? what is the significance of that? Regards Shikha
-
In the mfc application when does the Ondraw handler gets called? what is the significance of that? Regards Shikha
if you are referring to CView this is what I read from the docs : Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation. You must override this function to display your view of the document. You can make graphic device interface (GDI) calls using the CDC object pointed to by the pDC parameter. You can select GDI resources, such as pens or fonts, into the device context before drawing and then deselect them afterwards. Often your drawing code can be device-independent; that is, it doesn’t require information about what type of device is displaying the image. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_
-
if you are referring to CView this is what I read from the docs : Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation. You must override this function to display your view of the document. You can make graphic device interface (GDI) calls using the CDC object pointed to by the pDC parameter. You can select GDI resources, such as pens or fonts, into the device context before drawing and then deselect them afterwards. Often your drawing code can be device-independent; that is, it doesn’t require information about what type of device is displaying the image. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_
Also, you might lookup WM_PAINT in the docs. Your window will get redrawn in a number of circumstances, some that you might not be expecting, such as when you drag another window over your window, you will get numerous WM_PAINT (OnDraw) events. Not sure why you need to know "when" it gets called, just be prepared to handle OnDraw at any time, because you never know when it will be called. Or maybe you're wondering about the order events are fired...can't help you with that one...
- S 50 cups of coffee and you know it's on!