|
-
Jul 20th, 2009, 03:54 AM
#1
Thread Starter
Fanatic Member
[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.
Last edited by manhit45; Jul 20th, 2009 at 04:06 AM.
-
Jul 20th, 2009, 04:02 AM
#2
Re: To cursor.Hand when hover nodes.
Hi,
There's a mouseNodeHover event.
-
Jul 20th, 2009, 04:05 AM
#3
Thread Starter
Fanatic Member
Re: To cursor.Hand when hover nodes.
 Originally Posted by sparrow1
Hi,
There's a mouseNodeHover event.
I used it above. did you read my post carefully.
-
Jul 20th, 2009, 04:33 AM
#4
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
-
Jul 20th, 2009, 04:36 AM
#5
Re: Change cursor when hover nodes of treeview (help me please....)
 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.
-
Jul 20th, 2009, 04:37 AM
#6
Thread Starter
Fanatic Member
Re: Change cursor when hover nodes of treeview (help me please....)
 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.
-
Jul 20th, 2009, 04:44 AM
#7
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.
-
Jul 20th, 2009, 04:48 AM
#8
Thread Starter
Fanatic Member
Re: Change cursor when hover nodes of treeview (help me please....)
 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.
-
Jul 20th, 2009, 04:49 AM
#9
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.
-
Jul 20th, 2009, 04:56 AM
#10
Thread Starter
Fanatic Member
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.
-
Jul 20th, 2009, 05:43 AM
#11
Re: [RESOLVED] Change cursor when hover nodes of treeview (help me please....)
Sorry - quite right.. daft mistake - I was in a rush.
Last edited by keystone_paul; Jul 20th, 2009 at 05:49 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|