[RESOLVED] Make Visble When Mouse Is Over.
I'm trying to make a code that say's:
when the mouse is in the area of the toolbox1 then the toolbox1
becomes visble when he leaves, it becomes invisble.
It's simble but i can't find it.
and if it's possible like it falls down.
http://i54.tinypic.com/28o369.png
Thanks, Dwight
Re: Make Visble When Mouse Is Over.
try this. just set your toolstrip control's visible property to false in your designer, then add this code:
vb Code:
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If e.Y < 25 Then
ToolStrip1.Visible = True
Else
ToolStrip1.Visible = False
End If
End Sub
edit: change 25 to your toolstrip's height
Re: Make Visble When Mouse Is Over.
The code your posted works, i changed the height to 37.
but it don't become invisble again.
My mouse goes over it and it's visble, when it leaves it's still visble.
Re: Make Visble When Mouse Is Over.
Quote:
Originally Posted by
Dwight-Pre
The code your posted works, i changed the height to 37.
but it don't become invisble again.
My mouse goes over it and it's visble, when it leaves it's still visble.
What about using the ToolStrips MouseLeave event?
Code:
Private Sub Form1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If e.Y < ToolStrip1.Height Then
ToolStrip1.Visible = True
ToolStrip1.BringToFront()
End If
End Sub
Private Sub ToolStrip1_MouseLeave(sender As Object, e As System.EventArgs) Handles ToolStrip1.MouseLeave
ToolStrip1.Visible = False
End Sub
Re: Make Visble When Mouse Is Over.
(sorry, but i didn't know that there was a MouseLeave sub)
Works Perfect!
Thank you Edgemeal and Paul for the big help!