CComboBoxEx

The CComboBoxEx class extends the combo box control by providing support for image lists. By using CComboBoxEx to create combo box controls, you no longer need to implement your own image drawing code. Instead, use CComboBoxEx to access images from an image list.

Image List Support

In a standard combo box, the owner of the combo box is responsible for drawing an image by creating the combo box as an owner-draw control. When you use CComboBoxEx, you do not need to set the drawing styles CBS_OWNERDRAWFIXED and CBS_HASSTRINGS because they are implied. Otherwise, you must write code to perform drawing operations. A CComboBoxEx control supports up to three images per item: one for a selected state, one for an unselected state, and one for an overlay image.

Styles

CComboBoxEx supports the styles CBS_SIMPLE, CBS_DROPDOWN, CBS_DROPDOWNLIST, and WS_CHILD. All other styles passed when you create the window are ignored by the control. After the window is created, you can provide other combo box styles by calling the CComboBoxEx member function SetExtendedStyle. With these styles, you can:

These style flags are described further in Using CComboBoxEx in the Visual C++ Programmer’s Guide.

Item Retention and Callback Item Attributes

Item information, such as indexes for items and images, indentation values, and text strings, is stored in the Win32 structure COMBOBOXEXITEM, as described in the Platform SDK. The structure also contains members that correspond to callback flags.

For a detailed, conceptual discussion, see Using CComboBoxEx in the Visual C++ Programmer’s Guide.

#include <afxcmn.h>

Class MembersBase ClassHierarchy Chart

Sample   MFC Sample MFCIE

See Also   CComboBox