帮忙看下,CTreeCtrl控件通过SetImageList设置与图像列表关联后怎么取消它们的关联关系
帮忙看下,CTreeCtrl控件通过SetImageList设置与图像列表关联后如何取消它们的关联关系
如题,
想执行切换树形控件图标操作,但现在一旦设置了关联后,就不知道怎样取消原先的关联关系?
再想重新设置另外一套图像列表与树形控件行不通?
------解决思路----------------------
重设SetImageList之后,再更新每个节点的图标
------解决思路----------------------
CTreeCtrl::SetImageList
返回值
Pointertothepreviousimagelist,ifany;otherwise.
返回指向先前的图像列表的指针(如果有);否则返回NULL
参数说明
Pointertotheimagelisttoassign.Ifis,allimagesareremovedfromthetreeviewcontrol.
指向要被分配的图像列表的指针。如果pImageList是NULL,则从treeview控件中删除所有的图像。
Typeofimagelisttoset.Theimagelistcanbeoneofthefollowingvalues:
要设置的图像列表的类型。图像列表可以是下列值之一:lTVSIL_NORMAL获取常规的图像列表,它包含了该treeview项的被选择的和不被选择的图像。lTVSIL_STATE获取状态图像列表,它包含了处于用户定义状态的treeview项的图像。
Setsthenormalimagelist,whichcontainstheselectedandnonselectedimagesforthetreeviewitem.Setsthestateimagelist,whichcontainstheimagesfortreeviewitemsthatareinauser-definedstate.
------解决思路----------------------
CTreeCtrl tt;
tt.SetItem();
tt.SetItemImage(); 这是更改图标的方法
全部更新imagelist 可以销毁原来的imagelist设置新的
也可以更改原来的imagelist
imagelist.add
imagelist.replace 等等
------解决思路----------------------
CTreeCtrl::SetImageList
CImageList* SetImageList( CImageList * pImageList, int nImageListType );
Return Value
Pointer to the previous image list, if any; otherwise NULL.
Parameters
pImageList
Pointer to the image list to assign. If pImageList is NULL, all images are removed from the tree view control.
nImageListType
Type of image list to set. The image list can be one of the following values:
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.
Remarks
Call this function to set the normal or state image list for a tree view control and redraw the control using the new images.
这个函数不是可以实现么
------解决思路----------------------
1. 不需要 先设置为 0;
2. 如果 不自烩, 不需要 Invalidate
3. 第二个 HIMAGELIST 必须 创建 对。
------解决思路----------------------
请改成TVSIL_NORMAL
如题,
想执行切换树形控件图标操作,但现在一旦设置了关联后,就不知道怎样取消原先的关联关系?
再想重新设置另外一套图像列表与树形控件行不通?
------解决思路----------------------
重设SetImageList之后,再更新每个节点的图标
------解决思路----------------------
CTreeCtrl::SetImageList
返回值
Pointertothepreviousimagelist,ifany;otherwise.
返回指向先前的图像列表的指针(如果有);否则返回NULL
参数说明
Pointertotheimagelisttoassign.Ifis,allimagesareremovedfromthetreeviewcontrol.
指向要被分配的图像列表的指针。如果pImageList是NULL,则从treeview控件中删除所有的图像。
Typeofimagelisttoset.Theimagelistcanbeoneofthefollowingvalues:
要设置的图像列表的类型。图像列表可以是下列值之一:lTVSIL_NORMAL获取常规的图像列表,它包含了该treeview项的被选择的和不被选择的图像。lTVSIL_STATE获取状态图像列表,它包含了处于用户定义状态的treeview项的图像。
Setsthenormalimagelist,whichcontainstheselectedandnonselectedimagesforthetreeviewitem.Setsthestateimagelist,whichcontainstheimagesfortreeviewitemsthatareinauser-definedstate.
------解决思路----------------------
CTreeCtrl tt;
tt.SetItem();
tt.SetItemImage(); 这是更改图标的方法
全部更新imagelist 可以销毁原来的imagelist设置新的
也可以更改原来的imagelist
imagelist.add
imagelist.replace 等等
------解决思路----------------------
CTreeCtrl::SetImageList
CImageList* SetImageList( CImageList * pImageList, int nImageListType );
Return Value
Pointer to the previous image list, if any; otherwise NULL.
Parameters
pImageList
Pointer to the image list to assign. If pImageList is NULL, all images are removed from the tree view control.
nImageListType
Type of image list to set. The image list can be one of the following values:
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.
Remarks
Call this function to set the normal or state image list for a tree view control and redraw the control using the new images.
这个函数不是可以实现么
------解决思路----------------------
1. 不需要 先设置为 0;
2. 如果 不自烩, 不需要 Invalidate
3. 第二个 HIMAGELIST 必须 创建 对。
------解决思路----------------------
请改成TVSIL_NORMAL