Foxtable(狐表)用户栏目专家坐堂 → [求助] 目录树展开与关闭


  共有10652人关注过本帖平板打印复制链接

主题:[求助] 目录树展开与关闭

帅哥哟,离线,有人找我吗?
古奇
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:177 积分:1571 威望:0 精华:0 注册:2008/9/1 22:25:00
[求助] 目录树展开与关闭  发帖心情 Post By:2011/11/14 9:42:00 [只看该作者]

当单击节点时,选定的节点展开,同层的其它节点关闭。。

 

Dim nd As WinForm.TreeNode = trv.SelectedNode
Dim id As Integer = nd.index
If e.Node.Level = 0 Then
    Dim cnt As Integer  = trv.Nodes.Count - 1
    For i As Integer = cnt To 0 Step -1
        If trv.Nodes.Count >= 0 Then
            If i=id
                trv.Nodes(i).Expand()
            Else
                trv.Nodes(i).Collapse()
            End If
        End If
    Next

ElseIf e.Node.Level = 1 Then
    Dim cnt As Integer  = trv.Nodes.Count - 1
    For i As Integer = cnt To 0 Step -1
        If trv.Nodes.Count >= 0 Then
            If i=id
                trv.Nodes(i).Nodes(i).Expand()
            Else
                trv.Nodes(i).Nodes(i).Collapse()
            End If
        End If
    Next

End If

 

这个只能做到根节点,往下的就出错了。。。


 回到顶部