SetImageList
doesn't assign any icons to any items. It merely provides a list of icons that could be assigned to items. The actual assignment happens in SetItem
or InsertItem
, by setting COMBOBOXEXITEM::iImage
and/or iSelectedImage
members.
how to set image for each item in ComboboxEx?

Hi,
from this post,
I use the following code to assign an image to each item but it doesn't work ((no image is displayed)
CComboBoxEx mycombo;
CImageList m_ComboImageList;
m_ComboImageList.Create(24, 24, ILC_COLOR, 1, 1);
m_ComboImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON1)); //only one. [image 24x24.ico]
fMfc_combobox_filllist(mycombo, listwchar_t); //fill list wchar_t for combobox
mycombo.SetImageList(&m_ComboImageList); //<-assign icon for all items
Am I missing something?
Thanks you!
Developer technologies | C++
2 answers
Sort by: Most helpful
-
Igor Tandetnik 1,116 Reputation points
2021-06-01T01:58:03.307+00:00 -
Guido Franzke 2,191 Reputation points
2021-06-01T05:58:50.547+00:00 Hello,
have a look at this example: A-Combobox-with-bitmaps
Regards, Guido