How to change image when MouseHover and MouseLeave in window forms in C#.net ||How to change cursor to hand symbol when mouseHover in window forms in C#.net


To change image and cursor when mousehover and mouseleave in windows forms  dotnet application follow the below steps:
1.First design one test form with one button name as btnIncome.
2. Change button properties and import two images (mousehover image and mouseleave image) from your system.
In this I am taking two income images with the name income_btn_hover and income_btn_normal.

Then write the following code in btnIncome_MouseHover and btnIncome_MouseLeave event.
To change cursor symbol also I am writing code in mousehover and mouseleave events

private void btnIncome_MouseHover(object sender, EventArgs e)
        {
            this.btnIncome.Image = Properties.Resources.income_btn_hover;
            this.Cursor = Cursors.Hand;

        }


private void btnIncome_MouseLeave(object sender, EventArgs e)
        {
            this.btnIncome.Image = Properties.Resources.income_btn_normal;
            this.Cursor = Cursors.Arrow;
        }


Then run your application then you will get the following output form with one Income normal button .


If you mousehover on Income  button then it will change to Income hover button like below:





3 comments:


  1. Time is gold. We should treasure every second of it so that in time we will not regret anything because we only live ones.I have read your article and i was glad and inspired. Thanks for it, Cheers!
    Visit my site if you have time, Enjoy.

    n8fan.net

    www.n8fan.net

    ReplyDelete
  2. We all need challenges in our life to keep motivated. I really had a great time scanning and reading your blog site and i was so amazed with your great artwork. I do hope you could inspire more readers. You can also visit my site for some interesting stuff.

    n8fan.net

    www.n8fan.net

    ReplyDelete
  3. you may have an important weblog right here! would you wish to make some invite posts on my weblog? online casinos

    ReplyDelete