MFC General Owner Draw issues

CoderSource.net
MFC General Owner Draw issues
Rating:

Date: 5/1/2004 12:00:00 AM

When writing code for owner-draw combo boxes try to keep these guidelines:

   Use SetItemData, because it easy to get it with the DRAWITEMSTRUCT without making any obsolete and time consuming function calls.

   Check the state and action of the item to know when to draw selection rectangles. Check for the state ODS_SELECTED, and ODA_SELECT to handle this case.

   Find a way to know when the control has focus, and make the control show it. The focus is better passed as a parameter to the drawing functions. This will be a better logic. Come up with a different logic if you have some different types of handling them.

   Remember to return the old device context settings if you have changed them. If you don?t weird things might happen. This is one of the most important things to be done as advised by Microsoft.

   Try to avoid copy-pasting code when writing combo and list boxes with similar interface. Implement a single class which can be called for drawing the interface.  

You Can Rate this Article, if you are Logged In      
 

More Links from CoderSource.net:

 
Refer to a Friend:

Your Details:

Name:     e-mail:

Friend Details:

Name:    e-mail:    


MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Add to Google
Add to My Yahoo!
Welcome to Codersource.Net Login | Register | Faq  

SEARCH
Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us