TreeView.HotTracking

Parngon
03-04-2004, 02:12 AM
Hello,

I have set the HotTracking property of a treeview control so that when users use mouse to move over the nodes they will have a taste of Hyperlink Text. However, by setting HotTracking it will also automatically changed the ForeColor and the BackColor of the node that the mouse currently pointed at.

My question is, is there any property I can set to control the behavior of HotTracking? like instead it changes the color of text to blue, I want it to be red. or change the background color of the pointed node to be black (instead of white currently)?

I have also tried to not to use HotTracking and implemented the MouseEnter/MouseHover event raised by the treeview control myself, however since MouseEnter/MouseHover wont pass me an MouseEventArgs (unlike MouseUp/MouseDown), I have no idea which node is currently being pointed by the mouse cursor, thus cant change the appearence of that node myself.

Thanks in advance.

Machaira
03-26-2004, 08:52 AM
Maybe something like:



Private Sub TreeView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseMove

'change all nodes back

reset(TreeView1.Nodes)

Dim node As TreeNode = TreeView1.GetNodeAt(e.X, e.Y)

If Not (node Is Nothing) Then

node.ForeColor = Color.Red

End If

End Sub

Private Sub reset(ByVal nodes As TreeNodeCollection)

Dim node As TreeNode

For Each node In nodes

node.ForeColor = Color.Black

If node.Nodes.Count > 0 Then

reset(node.Nodes)

End If

Next node

End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum