MFC General Owner Draw issues

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.  

Close    To Top
  • Prev Article-Programming:
  • Next Article-Programming:
  • Now: Tutorial for Web and Software Design > Programming > c > Programming Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction