简体   繁体   中英

wxListCtrl does not show images

I make use of a wxListCtrl which has one column (so a really simple list). Based on the listctrl-sample I tried to have the list-items with a icon in front. Unfortunately only the text is shown but not the image.

That's my code (relevant parts only):

m_toolImages=new wxImageList(25,25);

m_hideList=new wxListCtrl(toolPanel,wxID_ANY,wxDefaultPosition,wxSize(180,-1),wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL);
m_hideList->AppendColumn(wxEmptyString);
m_hideList->SetColumnWidth(0,250);
m_hideList->SetImageList(m_toolImages,wxIMAGE_LIST_NORMAL);

imageID=m_toolImages->Add(bm); // bm is a wxBitmap wit a size of 25x25 pixels

m_hideList->InsertItem(i,"ItemName",imageID);

So...what could be missing here?

The report mode uses "small" image list and not the normal one, which is only used in the "icon" mode, so you need to set that one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM