Office Style Flat ComboBox | CodeGuru

Office Style Flat ComboBox

. For the latest updates and source code click here. Environment: VC5, VC6, WIN9x, NT4 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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Jul 19, 1999
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

.
For the latest updates and source code click here.

Office Style Flat ComboBox Demo

Environment: VC5, VC6, WIN9x, NT4

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. Below is and example
of how you might approach this.

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. 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().

Downloads

Download demo project – 46 Kb
Download source – 6 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.