Foxtable(狐表)用户栏目专家坐堂 → 如何给不同层级的树节点设置颜色


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

主题:如何给不同层级的树节点设置颜色

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


加好友 发短信
等级:五尾狐 帖子:1049 积分:8150 威望:0 精华:0 注册:2011/10/11 11:13:00
如何给不同层级的树节点设置颜色  发帖心情 Post By:2016/9/7 11:33:00 [只看该作者]

版主:
      如何给不同层级的树节点设置颜色?下述语句设置哪里有问题?

Dim Trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As  WinForm.TreeNode In trv.AllNodes
    If nd.Nodes.Count = 0 Then            ’0层级颜色
        nd.ForeColor = Color.Red
    End If
    If nd.Nodes.Count = 1 Then            ’1层级颜色       
        nd.ForeColor = Color.Blue
    End If
    If nd.Nodes.Count = 2 Then            ’2层级颜色        
        nd.ForeColor = Color.Blue
    End If
Next


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109447 积分:556891 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/9/7 12:04:00 [只看该作者]

Dim Trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As  WinForm.TreeNode In trv.AllNodes
    If nd.Level = 0 Then            '0层级颜色
        nd.ForeColor = Color.Red
    End If
    If nd.Level = 1 Then            '1层级颜色       
        nd.ForeColor = Color.Blue
    End If
    If nd.Level = 2 Then            '2层级颜色        
        nd.ForeColor = Color.Blue
    End If
Next

 回到顶部
帅哥哟,离线,有人找我吗?
包头123
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1049 积分:8150 威望:0 精华:0 注册:2011/10/11 11:13:00
  发帖心情 Post By:2016/9/7 14:01:00 [只看该作者]

谢谢了。

 回到顶部