Click here to Skip to main content
15,920,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Is it possible when i mouseover a button the picture behind the button (background) goes bigger en goes to default size when i mouseover another button?

Many thx!

Arend

What I have tried:

Tried not anything becaurse i don't know where to go from there.
Posted
Updated 7-Nov-17 9:24am
Comments
Karthik_Mahalingam 7-Nov-17 12:34pm    
windows or web ?

try

private void Form1_Load(object sender, EventArgs e)
        {
            button1.Width = 50; // set your default width
            button1.Height = 50; // set your default height
        }

        private void button1_MouseEnter(object sender, EventArgs e)
        {
            Button button = (sender as Button);
            button.Width = 100; // set the width to increase on mouse hover
            button.Height = 100;// set the height to increase on mouse hover
        }

        private void button1_MouseLeave(object sender, EventArgs e)
        {
            Button button = (sender as Button);
            button.Width = 50; // set to default width
            button.Height = 50; // set to default height
        }


refer Control.MouseEnter Event (System.Windows.Forms)[^]
Control.MouseLeave Event (System.Windows.Forms)[^]
Insert Image To Button and Set Alignment C# - YouTube[^]
 
Share this answer
 
v3
Comments
Arend Bosman 7-Nov-17 13:59pm    
Will try it thx!
When i try it in visual studio only this part works:

{
            button1.Width = 50; // set your default width
            button1.Height = 50; // set your default height
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900