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
DumdidumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gregory MillerGeneral ManagerCommented:
Draw the label using the default form background color and leave the border drawn at all times. The MouseEnter and MouseLeave events should simply change the color of the border. This will prevent the need to compensate for the movement of the text and should simplify the border display on and off visual effect you are looking for.

-greg
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.