MS Office family products often see flat combo boxes, this article will introduce a C + + class: Cxtflatcombobox, with this class can be easily implemented in their own program flat combo box, that is, the standard CComboBox control appearance flattened. The Cxtflatcombobox class is a member of the Codejoke Developer Kit Xtreme Toolkit. Anyone can use the source code for this class for free.
How to use:
Add the header file XTFlatComboBox.h and implementation file XTFlatComboBox.cpp of the Cxtflatcombobox class to the project, and then include the header file in the file that uses the class:#include "XTFlatComboBox.h"
Then declare the class instance in the implementation file, and you can add a CComboBox member variable with the Class Wizard (Classes Wizard): (Class Wizard-> membership Variables Tab-> add Variable). Then change the CComboBox to Cxtflatcombobox. Member variables are used primarily to control the combo box.
This example is a typical dialog box based program, the dialog box has two combo boxes, each combo box has a check button to control its shielding status, editable combo box with a "AutoComplete" function control. Figure one is the running picture of this example program:
Figure One Example program
The following is a simple description of the program code:
Header file:
The example program's two combo box styles are respectively droplist and Dropdown, their difference is needless to say, the former can enter content, the latter cannot.
//{{AFX_DATA(CFlatComboDemoDlg)
enum { IDD = IDD_FLATCOMBODEMO_DIALOG };
//声明类实例成员变量
CXTFlatComboBox m_DDCombo;
CXTFlatComboBox m_DLCombo;
//声明其它的成员变量
BOOL m_bDDAutoComp;
BOOL m_bDDDisable;
BOOL m_bDLDisable;
//}}AFX_DATA