请帮忙!我尝试通过图标、hbitmap 和 cbitmap 将图像加载到图像列表(我正在使用基于 mfc 对话框的应用程序)。但是图像不会显示出来。但是当我在一个空的 sdi mfc 应用程序上重新创建图像时,我设法查看了图像。
m_TreeInspCtrl.DeleteAllItems();
CImageList imgl_Tree;
imgl_Tree.Create(16, 16, ILC_COLOR32, 1, 1);
/*
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_TREE_PASS), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
*/
imgl_Tree.Add(AfxGetApp()->LoadIcon(IDI_ICON_PASS));
/*
CBitmap m_TreePass;
//m_TreePass.Attach(hBmp);
m_TreePass.LoadBitmap(IDB_TREE_PASS);
imgl_Tree.Add(&m_TreePass, RGB(255,0,255));
*/
m_TreeInspCtrl.SetImageList (&imgl_Tree, TVSIL_NORMAL);
CString s_Root = "Inspection Sequence";
HTREEITEM h_Root = m_TreeInspCtrl.InsertItem(s_Root, 0, 0, TVI_ROOT);
m_TreeInspCtrl.SetItemColor(h_Root, RGB(0, 150, 0));