VC How to achieve the Office style flat combo box

Source: Internet
Author: User
Tags bool header

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.