65.9K
CodeProject is changing. Read more.
Home

A Combobox with bitmaps

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.75/5 (6 votes)

Nov 25, 1999

viewsIcon

336310

downloadIcon

6625

A combo box that can be used to display bitmaps

Sample Image

This control was made after the useful Icon Picker Combo Box by Joel Wahlberg.

Usage

  1. Include CBitmapPickerCombo.cpp and CBitmapPickerCombo.h in your project
  2. In the resource editor, create a regular combobox with at least the following styles: DropList, OwnerDraw Variable, Has Strings
  3. Create a control member variable for the combobox in VC's classwizard
  4. Replace CComboBox with CBitmapPickerCombo in your dialog's .h file
  5. In OnInitDialog, use the AddBitmap or InsertBitmap member functions to add CBitmaps (and optional strings) to the combobox

The height of the combobox is automatically set to the highest bitmap.

Relevant Member Function Prototypes

int CBitmapPickerCombo::AddBitmap(const CBitmap *bitmap, const char *string = NULL);
int CBitmapPickerCombo::InsertBitmap
    (int nIndex, const CBitmap *bitmap, const char *string = NULL);

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below. A list of licenses authors might use can be found here.