Dumdidum
asked on
Mouse over: Border, else not!
Hi
I have a label and now I want to do this:
If I move the mouse over the label, the border around the label should appear, if I move away from the label the border should disappear
It's clear to use the mouse_enter and mouse_leave-property and that is working correctly but the problem is the following:
If I activate the border, the text in the label will move one pixel to right and to the bottom. To equilaze that I have used:
Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter
Label1.Top = Label1.Top - 1
Label1.Left = Label1.Left - 1
Label1.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub Label1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave
Label1.Top = Label1.Top + 1
Label1.Left = Label1.Left + 1
Label1.BorderStyle = BorderStyle.None
End Sub
But that's not working correctly. It is activating the border but if I leave the label with the mouse on the botton or right border the border is not disappearing...
How can I solve that?
Thanks a lot
Sven
I have a label and now I want to do this:
If I move the mouse over the label, the border around the label should appear, if I move away from the label the border should disappear
It's clear to use the mouse_enter and mouse_leave-property and that is working correctly but the problem is the following:
If I activate the border, the text in the label will move one pixel to right and to the bottom. To equilaze that I have used:
Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter
Label1.Top = Label1.Top - 1
Label1.Left = Label1.Left - 1
Label1.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub Label1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave
Label1.Top = Label1.Top + 1
Label1.Left = Label1.Left + 1
Label1.BorderStyle = BorderStyle.None
End Sub
But that's not working correctly. It is activating the border but if I leave the label with the mouse on the botton or right border the border is not disappearing...
How can I solve that?
Thanks a lot
Sven
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.