返回值
Pointer to the previous image list, if any; otherwise NULL.
返回指向先前的圖像列表的
指針(如果有);否則返回NULL
參數說明
pImageList
Pointer to the image list to assign. If pImageList is NULL, all images are removed from the tree view control.
指向要被分配的圖像列表的指針。如果pImageList是NULL,則從tree view控制項中刪除所有的圖像。
nImageListType
Type of image list to set. The image list can be one of the following values:
要設定的圖像列表的類型。圖像列表可以是下列值之一:l TVSIL_NORMAL 獲取常規的圖像列表,它包含了該tree view項的被選擇的和不被選擇的圖像。l TVSIL_STATE 獲取狀態圖像列表,它包含了處於用戶定義狀態的treeview項的圖像。
TVSIL_NORMAL Sets the normal image list, which contains the selected and nonselected images for the tree view item.TVSIL_STATE Sets the state image list, which contains the images for tree view items that are in a user-defined state.
備註
Call this function to set the normal or state image list for a tree view control and redraw the control using the new images.
此成員函式用來設定一個tree view控制項的常規或狀態圖像列表,並使用新的圖
CTreeCtrl Overview | Class Members | Hierarchy Chart
相關資料
CImageList, CTreeCtrl::GetImageList
參考事例
//圖示句柄數組HICON hIcon[3];//載入三個圖示,並將它們的句柄保存到數組hIcon[0]=theApp.LoadIcon(IDI_WEB_ICON);hIcon[1]=theApp.LoadIcon(IDI_CATALOG_ICON);hIcon[2]=theApp.LoadIcon(IDI_ARTICLE_ICON);//創建圖像序列CImageList對象m_imageList.Create(32,32,ILC_COLOR32,3,3);//將三個圖示添加到圖像序列for(inti=0;i<3;i++){m_imageList.Add(hIcon[i]);}//為樹形控制項設定圖像序列m_webTree.SetImageList(&m_imageList,TVSIL_NORMAL);////////以上為初始化部分/////////////設定樹形控制項圖示m_webTree.SetItemImage(hParItem,1,1);第一個參數為:項的句柄第二個參數為:圖示列表的索引(非選擇狀態)第三個參數為:圖示列表的索引(選擇狀態)