Click here to Skip to main content
6,595,854 members and growing! (17,631 online)
Email Password   helpLost your password?
Desktop Development » Combo & List Boxes » ComboBox Controls     Intermediate

Office Style Flat ComboBox

By Kirk Stowell

A drop-in replacement combobox that gives your apps the flat Office-style look
VC6, MFC, Dev
Posted:15 Dec 1999
Views:85,810
Bookmarked:38 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
30 votes for this article.
Popularity: 5.39 Rating: 3.65 out of 5
3 votes, 21.4%
1

2
1 vote, 7.1%
3
2 votes, 14.3%
4
8 votes, 57.1%
5
  • Download demo project - 46 Kb
  • Download source files - 7 Kb
  • Sample Image - combobox_flatcombo.gif

    This control easily gives your application the Flat Look that is seen in the Microsoft office products. To use the control, simply add the files CCJFlatComboBox.cpp and CCJFlatComboBox.h to your project. You can use Class Wizard to add the CCJFlatComboBox member variables ( you most likely will have to rebuild the .clw file associated with your project ), or just replace any instance of CComboBox , with CCJFlatComboBox .

    Example

    Below is and example of how you might add the control to your project.

    Header file:

    //{{AFX_DATA(CFlatComboDemoDlg)  
    
    enum { IDD = IDD_FLATCOMBODEMO_DIALOG };  
    CCJFlatComboBox m_DDCombo;  
    //}}AFX_DATA  
    
    

    Implementation file:

    //{{AFX_DATA_MAP(CFlatComboDemoDlg)  
    
    DDX_Control(pDX, IDC_DROPDOWN_COMBO, m_DDCombo);  
    //}}AFX_DATA_MAP  
    
    

    Acknowledgements:

    • Chris Maunder - For letting me use his color picker class, and for his auto-completion code. I made some modifications to the appearance of the control that is used in this demo. My modifications are noted.
    • Gilberto Botaro - For his help with adding auto completion to the CCJFlatComboBox class.
    • Vachik Hovhannissian and Danilo Lax - For help with fixing focus and message handling bugs.
    • Yosh Yamashita - For help with fixing accelerator bug.
    • Shannon McCoy - For suggestions on using ::GetSysColor(...) and ::GetSystemMetrics(...) more efficiently.
    • Todd Brannam - For help with fixing offset bug to use GetSystemMetrics().

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Kirk Stowell


    Member

    Occupation: CEO
    Company: Codejock Software
    Location: United States United States

    Other popular Combo & List Boxes articles:

    Article Top
    You must Sign In to use this message board.
    FAQ FAQ 
     
    Noise Tolerance  Layout  Per page   
     Msgs 1 to 4 of 4 (Total in Forum: 4) (Refresh)FirstPrevNext
    NewsUpon Reflection Pinmemberhibachirat15:39 2 Feb '06  
    Generaluseful but... Pinmembertoxcct2:56 5 Apr '05  
    GeneralCComboBoxEx me too PinmemberBadJerry2:30 5 Apr '05  
    GeneralUpgrade to a CComboBoxEx? PinmemberJeremy Davis6:23 30 Nov '00  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    PermaLink | Privacy | Terms of Use
    Last Updated: 15 Dec 1999
    Editor: Chris Maunder
    Copyright 1999 by Kirk Stowell
    Everything else Copyright © CodeProject, 1999-2009
    Web20 | Advertise on the Code Project