CComboBoxEx Class
Extends the combo box control by providing support for image lists.
class CComboBoxEx : public CComboBox
Remarks
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:
Set string searches in the list to be case-sensitive.
Create a combo box control that uses the slash ('/'), backslash ('\'), and period ('.') characters as word delimiters. This allow users to jump from word to word, using the keyboard shortcut CTRL+ ARROW.
Set the combo box control to either display or not display an image. If no image is displayed, the combo box can remove the text indent that accommodates an image.
Create a narrow combo box control, including sizing it so it clips the wider combo box it contains.
These style flags are described further in Using CComboBoxEx.
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 Windows SDK. The structure also contains members that correspond to callback flags.
For a detailed, conceptual discussion, see Using CComboBoxEx.
Requirements
Header: afxcmn.h
Smart Device Developer Notes
This class is not supported in Smart Device projects.
See Also
Tasks
MFCIE Sample: Demonstrates the MFC CHtmlView and CReBar Classes