简体   繁体   English

wxListCtrl 不显示图像

[英]wxListCtrl does not show images

I make use of a wxListCtrl which has one column (so a really simple list).我使用了一个只有一列的 wxListCtrl(这是一个非常简单的列表)。 Based on the listctrl-sample I tried to have the list-items with a icon in front.基于 listctrl-sample,我尝试让列表项前面有一个图标。 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.报告模式使用“小”图像列表而不是普通的图像列表,它只在“图标”模式下使用,所以你需要设置那个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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