Foxtable(狐表)用户栏目专家坐堂 → 请问treeview 可指定打开时显示几层吗?


  共有1790人关注过本帖树形打印复制链接

主题:请问treeview 可指定打开时显示几层吗?

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111401 积分:567075 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/8/5 8:57:00 [显示全部帖子]

Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")

For Each n As WinForm.TreeNode In trv.Nodes
    n.Expand
    For Each n1 As WinForm.TreeNode In n.Nodes
        n.Expand
    Next
Next


Dim lv As Integer = 0
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")

For Each n As WinForm.TreeNode In trv.AllNodes
    If n.Level <= lv
        n.Expand
    End If
Next

还可以使用递归实现吗,自己思考一下


 回到顶部