标签:
imgList = new CImageList;
HICON icon[4];
icon[0] = AfxGetApp()->LoadIcon(IDI_ICONA);
icon[1] = AfxGetApp()->LoadIcon(IDI_ICONB);
icon[2] = AfxGetApp()->LoadIcon(IDI_ICONC);
icon[3] = AfxGetApp()->LoadIcon(IDI_ICOND);
/*CImageList **/imgList = new CImageList;
imgList->Create(16, 16, ILC_COLOR32|ILC_MASK,20, 1);//使用背景透明的位图
imgList->Add(icon[0]);
imgList->Add(icon[1]);
imgList->Add(icon[2]);
imgList->Add(icon[3]);
m_InfoTree.SetImageList(imgList,LVSIL_NORMAL);
//为m_mytree设置一个图像列表,使CtreeCtrl的节点显示不同的图标
m_InfoTree.SetBkColor(RGB(255,255,255));//设置m_mytree的背景色
m_InfoTree.DeleteAllItems();
m_InfoTree.SetTextColor(RGB(0xF5,0xFA,0xFF));
HTREEITEM RootItem =m_InfoTree.InsertItem("功能菜单",3,3,TVI_ROOT,TVI_LAST); 红色的位置标示的是图片的索引
m_InfoTree.SetBkColor(RGB(0xF5,0xFA,0xFF));
m_InfoTree.SetTextColor(RGB(0,0,0));
HTREEITEM LeafItem1 = m_InfoTree.InsertItem("信息",2,2,RootItem,TVI_LAST);
HTREEITEM LeafItem2 = m_InfoTree.InsertItem("服务器",2,2,RootItem,TVI_LAST);
HTREEITEM LeafItem3 = m_InfoTree.InsertItem("日志",2,2,RootItem,TVI_LAST);
m_InfoTree.Expand(RootItem,TVE_EXPAND);
一下为释放CImageLIse类型的代码
// int iImageCount = imgList->GetImageCount();
// for( int i=0; i < iImageCount; i++ )标签:
原文地址:http://blog.csdn.net/syytem004/article/details/43791497