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:





1 comment:

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

    ReplyDelete