mouse over effects in vb.net winform? Changing button image

Hello experts, is there an easy way to change the image of a button when I mouse over the button?  I am using visual studio.net 2003.  This is a very easy to in a web form usually requiring a small bit of javascript.  I am, however, having difficulty getting this to work on my winform.  I have a button object on my form that has an image on it, I want to change the image when I move the mouse across the button.  What I have found on the net is that it takes a lot of code and I have to dig into the GDI class to make it work.  
tentavariousAsked:
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.

Mike TomlinsonMiddle School Assistant TeacherCommented:
Set your default Image on your button.  Then add your "mouse over" image to your project as an embedded resource.  Click on Project --> Add Existing Item and select the image.  Next select the Image in your Solution explorer pane and down below in the Properties pane change the "Build Action" from "Content" to "Embedded Resource".

Now you can use code like this to load the "mouse over" image at form load the store it in the buttons tag.  Swap the images in the MouseEnter and MouseLeave events.  Be sure to change the name of the file below to your "mouse over" image.  The name in this situation IS case sensitive.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Tag = New Bitmap(Me.GetType, "unfazed.ico")
    End Sub

    Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
        Dim tmpBmp As Bitmap
        tmpBmp = Button1.Tag
        Button1.Tag = Button1.Image
        Button1.Image = tmpBmp
    End Sub

    Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
        Dim tmpBmp As Bitmap
        tmpBmp = Button1.Tag
        Button1.Tag = Button1.Image
        Button1.Image = tmpBmp
    End Sub
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
tentavariousAuthor Commented:
Well, I must be missing a step, the image changes on mouseover but I my initial image does not come back it just becomes a blank button.
0
tentavariousAuthor Commented:
Never mind found the answer, thanks for the help great work.
0
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.