Hello,
I have a form that fades out on mouse leave, but what I would like to do is to stop the fade out if the mouse returns to the form before it disappears. Is that easy to achieve?
Also, the fadeout I am using is not very effective. My form has a tabcontrol covering the entire form area. I have tried setting the form1_mouseleave event and also the tabcontrol1_mouseleave event, but neither guarantees that the form will fade if I move the mouse away. 9 times out of 10 I find I have to move the mouse slowly onto the top bar of the form window to make the form fade.
My code is:
Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
Dim clientPos As Point = PointToClient(Cursor.Position)
If Not ClientRectangle.Contains(clientPos) Then
Timer_Fade.Enabled = True
End If
End Sub
Private Sub Timer_Fade_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer_Fade.Tick
If Me.Opacity > 0.1 Then
Me.Opacity -= 0.1
Else
Timer_Fade.Enabled = False
End If
End Sub
Thanks in advance
I have a form that fades out on mouse leave, but what I would like to do is to stop the fade out if the mouse returns to the form before it disappears. Is that easy to achieve?
Also, the fadeout I am using is not very effective. My form has a tabcontrol covering the entire form area. I have tried setting the form1_mouseleave event and also the tabcontrol1_mouseleave event, but neither guarantees that the form will fade if I move the mouse away. 9 times out of 10 I find I have to move the mouse slowly onto the top bar of the form window to make the form fade.
My code is:
Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
Dim clientPos As Point = PointToClient(Cursor.Position)
If Not ClientRectangle.Contains(clientPos) Then
Timer_Fade.Enabled = True
End If
End Sub
Private Sub Timer_Fade_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer_Fade.Tick
If Me.Opacity > 0.1 Then
Me.Opacity -= 0.1
Else
Timer_Fade.Enabled = False
End If
End Sub
Thanks in advance