[RESOLVED] Change cursor when hover nodes of treeview (help me please....)
I want when i hover my mouse to nodes of treeview the cursor is hand type.
Code:
Private Sub TREEVIEW2_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeView1.NodeMouseHover
Me.TreeView1.Cursor = Cursors.Hand
End Sub
I did this. But i want when i leave nodes the cursor back to default. :down:
Re: To cursor.Hand when hover nodes.
Hi,
There's a mouseNodeHover event.
Re: To cursor.Hand when hover nodes.
Quote:
Originally Posted by
sparrow1
Hi,
There's a mouseNodeHover event.
I used it above. did you read my post carefully.
Re: Change cursor when hover nodes of treeview (help me please....)
Private Sub TREEVIEW2_....
Where is the rest m8 ;)
Shouldn't it be :
vb.net Code:
Private Sub TREEVIEW2_NodeMouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeView1.NodeMouseHover
Re: Change cursor when hover nodes of treeview (help me please....)
Quote:
Originally Posted by
Radjesh Klauke
Private Sub TREEVIEW2_....
Where is the rest m8 ;)
Shouldn't it be :
vb.net Code:
Private Sub TREEVIEW2_NodeMouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeView1.NodeMouseHover
The name of the sub is totally irrelevant, the only important bit is the Handles clause at the end. Unlike VB6 and earlier where the name of the routine had to be the event name.
Re: Change cursor when hover nodes of treeview (help me please....)
Quote:
Originally Posted by
Radjesh Klauke
Private Sub TREEVIEW2_....
Where is the rest m8 ;)
Shouldn't it be :
vb.net Code:
Private Sub TREEVIEW2_NodeMouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeView1.NodeMouseHover
It doesnt effect to my code. Please tell me. when i leave nodes i want the cursor back to default.
Re: Change cursor when hover nodes of treeview (help me please....)
Hi,
After some research I think you'll need the OnmouseHover method to do so.
Here's the link.
Re: Change cursor when hover nodes of treeview (help me please....)
Quote:
Originally Posted by
sparrow1
Hi,
After some research I think you'll need the OnmouseHover method to do so.
Here's the link.
i have just read that document but i cant find out solution for my trouble.
Re: Change cursor when hover nodes of treeview (help me please....)
The MouseHover method applies to the treeview not the node.
Hovering events are no use anyway because you would need a "StoppedHovering" event to tell you when the hovering had stopped.
You'll need something like this :
Code:
Private Sub TreeView1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseMove
If CType(sender, TreeView).GetNodeAt(New Point(e.X, e.Y)) Is Nothing Then
Me.TreeView1.Cursor = Cursors.Hand
Else
Me.TreeView1.Cursor = Cursors.Default
End If
End Sub
Note that doesn't actually work - haven't had chance to test it properly yet and going to have to dash. I suspect e.X and e.Y are returning screen co-ordinates rather than the co-ordinates within the control, but that should be easy enough to fix.
Re: Change cursor when hover nodes of treeview (help me please....)
Thanks Paul (You miss 'not' keyword)
I remembered vaguely about that method but i cant do exactly as you.
Thanks again.
Re: [RESOLVED] Change cursor when hover nodes of treeview (help me please....)
Sorry - quite right.. daft mistake - I was in a rush.