HTREEITEM InsertItem( LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST );nImage Index of the item's image in the tree view control's image list. nSelectedImage Index of the item's selected image in the tree view control's image list. 把这两个参数设置成不一样的图像索引就好了!!
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
m_Tree.SetImageList(&m_ImageList,LVSIL_NORMAL);
m_Root = m_Tree.InsertItem("学校",0,0);
m_Child1 = m_Tree.InsertItem("一年级",1,1,m_Root);
m_Child2 = m_Tree.InsertItem("龙马",2,2,m_Child1);[/align]我是这么写的,那么第一个图片是节点m_Root的,第二个是m_child1的,第三个是m_child2的.
我现在想的是m_Root不要有图片,m_child1有,m_child2也不要有
我没说清楚,初始化的时候已经加了上面的图标了的,现在我想把m_child1的图标改成其他的
LPCTSTR lpszItem,
int nImage,
int nSelectedImage,
HTREEITEM hParent = TVI_ROOT,
HTREEITEM hInsertAfter = TVI_LAST
);nImage
Index of the item's image in the tree view control's image list.
nSelectedImage
Index of the item's selected image in the tree view control's image list.
把这两个参数设置成不一样的图像索引就好了!!