Mouse over: Border, else not!
Posted on 2004-10-23
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
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
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