如何在TreeView中获取父节点和子节点的索引? [英] How to get index of parent node and child node in treeview?
问题描述
你好,
我创建了1个application.in,我不得不使用treeview.
如;
1.节点
一个. Node1
b. Node2
2.类型
一个. Int
b.布尔
3.尺寸
一个. 1
b. 2
在上面的例子中,Node,Type,size是父节点.所以我想要这些paren节点的索引,也想要子节点.假设我选择Node-> node1然后选择initailly,然后选择相关名称列表现在我选择Type-> int ii不了解如何比较它.默认情况下,我得到与Node-> node1相关的所有名称.我只想要父级和子级node的索引.
Hello,
I create 1 application.in that i ave to use treeview.
Such as;
1.Node
a. Node1
b. Node2
2.Type
a. Int
b. Bool
3.Size
a. 1
b. 2
In above example Node,Type,size are parent node.So i want the index of these paren node as well as also want for child node also.Suppose I select Node-->node1 then initailly after selecting i get list of names related to it.Now i select Type-->int that i i don''t understand how to compare it.bydefault i get all name related to Node-->node1.I just want index of parent and child node.remainind disply part i done it.
推荐答案
只需尝试一下....
Just try this....
int a = treeView1.SelectedNode.Parent.Index;
int b = treeView1.SelectedNode.FirstNode.Index;
问候
塞巴斯蒂安
Regards
Sebastian
这篇关于如何在TreeView中获取父节点和子节点的索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!