回 帖 发 新 帖 刷新版面

主题:关于CTreeCtrl::InsertItem()的参数问题

HTREEITEM InsertItem( 
LPCTSTR lpszItem, 
int nImage, 
int nSelectedImage, 
HTREEITEM hParent = TVI_ROOT, 
HTREEITEM hInsertAfter = TVI_LAST );
这个函数的第二个和第三个参数是什么东西?

nImage 
Specifies the index of the image for the item in the image list of the tree view control.
nSelectedImage 
Specifies the index of the item’s selected image in the image list of the tree view control. 
上面是MSDN的解释,我没看懂

有段例子中的代码是这样写的:
m_tree.InsertItem("李四",3,3,userItem[0]);
我把3和3改成任意数字好象都行
希望有人帮我解释下这个两个参数是干嘛的

回复列表 (共2个回复)

沙发

第二个参数是表示当前节点普通状态下的图标索引
第三个参数是表示当前节点被选中状态下的图标索引

板凳

这个问题我以前也接触过,开始的时候我也找不到问题的原因,后来我进了一个技术交流群,这个群里的人挺多的,在里面可以沟通技术,你可以进去看一下.群号是:六#二#八#七#八#零#四#三。另外,这个群里可以接项目。

我来回复

您尚未登录,请登录后再回复。点此登录或注册