P
Das einfachste ist sicher eine CComboBoxEx.
Die Icons malst du alle nebeneinander in ein Bitmap, daraus konstruierst du eine CImageList (Member vom Dialog). mit cbx.SetImageList der ComboBox bescheid sagen, wo die Boilder herkommen sollen, und dann noch eine kleine Hilfsfunktion:
/// \param cbx: Pointer to the ComboBoxEx ctrl
/// \param item: insertion index, or -1 to append at end
/// \param text: Text of the new item
/// \param img: icon index in the image list (provided by SetImageList)
/// \param selImg: icon image in the image list to display when the item is selected
/// \param lp: caller defined parameter associated with the item ("ItemData")
bool CBxInsertItem(CComboBoxEx * wnd, int item, LPCTSTR text, int img = -1, int selImg = -1, LPARAM lp = 0)
{
_ASSERTE(::IsWindow(wnd->GetSafeHwnd()));
if (!::IsWindow(wnd->GetSafeHwnd()))
return -1;
COMBOBOXEXITEM cbx;
ZeroMemory(&cbxItem, sizeof(cbxItem));
if (item < 0) // append item at end:
item = wnd->GetItemCount();
cbx.mask = CBEIF_TEXT | CBEIF_LPARAM;
cbx.iItem = item;
cbx.pszText = text;
if (img >= 0) { // add image
cbx.mask |= CBEIF_IMAGE;
cbx.iImage = img;
}
if (selIng >= 0) { // add selected image
cbx.mask |= CBEIF_SELECTEDIMAGE;
cbx.iImage = selImg;
}
return wnd->InsertItem(&cbx);
}