Sirdots
asked on
changing backcolor of button to red when users move their mouse over the button
Hi,
I am using visual studio 2005 (C#). I want a situation where when users move their mouse over a button the backcolor changes to red. How can I achieve this please?
Sirdots.
I am using visual studio 2005 (C#). I want a situation where when users move their mouse over a button the backcolor changes to red. How can I achieve this please?
Sirdots.
Is this a button on a windows form or on an asp.net webpage ?
Button button1 = new Button();
Color c = button1.BackColor;
button1.MouseEnter += new System.EventHandler(this.b utton1_Mou seEnter);
button1.MouseLeave += new System.EventHandler(this.b utton1_Mou seLeave);
private void button1_MouseEnter(object sender, System.EventArgs e) {
this.button1.BackColor = Color.Red;
}
private void button1_MouseLeave(object sender, System.EventArgs e) {
this.button1.BackColor = c;
}
Color c = button1.BackColor;
button1.MouseEnter += new System.EventHandler(this.b
button1.MouseLeave += new System.EventHandler(this.b
private void button1_MouseEnter(object sender, System.EventArgs e) {
this.button1.BackColor = Color.Red;
}
private void button1_MouseLeave(object sender, System.EventArgs e) {
this.button1.BackColor = c;
}
ASKER
This is a button on a windows form please
see above
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to everyone