Foxtable(狐表)用户栏目专家坐堂 → [求助]LayersTree鼠标光标移动目录树节点字体背景色突显


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

主题:[求助]LayersTree鼠标光标移动目录树节点字体背景色突显

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


加好友 发短信
等级:三尾狐 帖子:660 积分:5180 威望:0 精华:0 注册:2019/7/26 12:54:00
[求助]LayersTree鼠标光标移动目录树节点字体背景色突显  发帖心情 Post By:2022/6/1 9:11:00 [显示全部帖子]

如题,LayersTree下面代码报错,求助修改

static pnd As object

Dim tree As System.windows.Forms.treeview = e.sender.basecontrol

Dim x As Integer = System.Windows.Forms.Cursor.Current.Position.X

Dim y As Integer = System.Windows.Forms.Cursor.Current.Position.Y

Dim pt = tree.PointToClient(new Point(X, Y))  '取当前坐标

Dim nd As System.Windows.Forms.TreeNode = tree.GetNodeAt(pt) '取坐标所在位置的节点

If nd Is Nothing OrElse pnd Is Nothing OrElse pnd.name <> nd.name Then

    For Each nnd As WinForm.TreeNode In e.Sender.AllNodes

        nnd.BackColor = color.white  '选中节点背景色

        nnd.ForeColor = color.blue  '选中节点字体色

    Next

   

    If nd IsNot Nothing

        nd.BackColor = color.PeachPuff   '鼠标移动在未选中节点上的背景色

        nd.ForeColor = color.blue  '鼠标移动在未选中节点上的字体颜色

    End If

End If

pnd = nd



 回到顶部