請幫忙!我已經試過通過圖標,hbitmap和cbitmap(我使用mfc基於對話框的應用程序)將圖像加載到圖像列表。但圖像不會顯示出來。但是當我在空的sdi mfc應用程序上重新創建它時,我設法查看了圖像。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));
你的問題是什麼?也請刪除'請幫助',這不是禮貌。 – sashoalm 2013-02-22 07:34:44