如何遍历treeview中的某一节点的子节点

shuzzz 2002-04-04 01:31:44
我想实现复选一个节点时,其子节点均被选中。
注意节点的key没有命名的规律!
...全文
65 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyl910 2002-04-06
  • 打赏
  • 举报
回复
给分方法:http://www.csdn.net/help/over.asp
288794 2002-04-06
  • 打赏
  • 举报
回复
点击"管理"
shuzzz 2002-04-06
  • 打赏
  • 举报
回复
我该如何给分!
烨炜带火 2002-04-04
  • 打赏
  • 举报
回复
Private Sub TreeView1_NodeCheck(ByVal Node As MSComctlLib.Node)
Dim m_Node As Node
'On Error Resume Next
If Not (Node.Parent Is Nothing) Then
If Node.Checked = True Then
Node.Parent.Checked = True
End If
End If
If Node.Children > 0 And Node.Checked = True Then
Node.Expanded = True
Node.EnsureVisible
Set m_Node = Node.Child
Set m_Node = m_Node.FirstSibling
m_Node.Checked = True
Do While Not (m_Node Is Nothing)
Set m_Node = m_Node.Next
If Not (m_Node Is Nothing) Then
m_Node.Checked = True
End If
Loop
ElseIf Node.Children > 0 And Node.Checked = False Then
Node.Expanded = False
Node.EnsureVisible
Set m_Node = Node.Child
Set m_Node = m_Node.FirstSibling
m_Node.Checked = False
Do While Not (m_Node Is Nothing)
Set m_Node = m_Node.Next
If Not (m_Node Is Nothing) Then
m_Node.Checked = False
End If
Loop
End If
End Sub
tonton 2002-04-04
  • 打赏
  • 举报
回复
一个节点下面的所有节点的FULLPATH的前面部份必定是这个“母”节点的FULLPATH。

从这一点可以用一个循环得到。
thorkhan 2002-04-04
  • 打赏
  • 举报
回复
FirstSibling
LastSibling
Next
Previous
這些屬性知道怎么用了巴
shawls 2002-04-04
  • 打赏
  • 举报
回复


for i=0 to treeview.nodes.count-1
msgobx treeview.nodex.item(i).text & treeview.nodex.item(i).key
next i

msg:the nodes.children and nodes.child you can use this

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧