vc給imagelist加圖示
請問treeview控制元件和treectrl控制元件的用法有何不同呢?向如何imagelist控制元件中加圖象呀?
[解決方法]
1)
HICON hicon[8];
m_imageList.Create(16,16,0,8,8);
hicon[0]=AfxGetApp()->LoadIcon(IDI_ICON0);
hicon[1]=AfxGetApp()->LoadIcon(IDI_ICON1);
hicon[2]=AfxGetApp()->LoadIcon(IDI_ICON2);
hicon[3]=AfxGetApp()->LoadIcon(IDI_ICON3);
hicon[4]=AfxGetApp()->LoadIcon(IDI_ICON4);
hicon[5]=AfxGetApp()->LoadIcon(IDI_ICON5);
hicon[6]=AfxGetApp()->LoadIcon(IDI_ICON6);
hicon[7]=AfxGetApp()->LoadIcon(IDI_ICON7);
for(int n=0;n<8;n++)
m_imageList.Add(hicon[n]);
CTreeCtrl *pTree=(CTreeCtrl *)GetDlgItem(IDC_TREE);
pTree->SetImageList(&m_imageList,TVSIL_NORMAL);
2)
CImageList cil1;
cil1.Create(32,32,TRUE,2,2);
cil1.Add(pApp->LoadIcon(IDI_DAO1));
cil1.Add(pApp->LoadIcon(IDI_DAO2));
cil1.Add(pApp->LoadIcon(IDI_DAO3));
cil1.Add(pApp->LoadIcon(IDI_DAO4));
cil1.Add(pApp->LoadIcon(IDI_DAO5));
cil1.Add(pApp->LoadIcon(IDI_DAO6));
cil1.Add(pApp->LoadIcon(IDI_DAO7));
cil1.Add(pApp->LoadIcon(IDI_DAO8));
cil1.Add(pApp->LoadIcon(IDI_DAO9));
//設定圖象列表
m_list.SetImageList(&cil1,LVSIL_NORMAL);