Self Drawn v. Owner Drawn  
Author Message
GLutz78





PostPosted: Visual C++ Language, Self Drawn v. Owner Drawn Top

Can someone please clarify this terminology for me: What is the difference between self drawing and owner drawing in MFC




Visual C++12  
 
 
Brian Kramer





PostPosted: Visual C++ Language, Self Drawn v. Owner Drawn Top

Controls (buttons, list boxes, etc) usually paint themselves when WM_PAINT is received (e.g. it implements the WM_PAINT message handler). An owner-draw control is one where you provide the WM_PAINT handler. Some controls let you paint the individual contents, such as items of list boxes, which requires that you handle special notifications from the control--the method of owner-drawing in this way varies from control to control.
 
 
GLutz78





PostPosted: Visual C++ Language, Self Drawn v. Owner Drawn Top

Regarding painting individual contents of list boxes, etc, are you referring to the DrawItem/MeasureItem functions Are these functions called implicitly by the OnPaint handler

 
 
Martin Richter





PostPosted: Visual C++ Language, Self Drawn v. Owner Drawn Top

Yes! The DrawItem and MeasureItem are called by the WM_PAINT handler as often as needed. They give you more control than handling your own WM_PAINT, because you just have to handle one item after another.

So overriding WM_PAINT might disturb the default handling.