I need to change button BackColor on focus.
Now I am using MouseOverBackColor
<=Silver in a button.
When I focus the button by mouse, its backcolor changed to Silver.
When I focus the button by tab key or .focus()
from code behind,I want to change the backcolor of it to Silver.
Which event should I use?
Can anybody help me,please?
Thanks.
0
votes
2 Answers
1
votes
1
votes
In order to keep consistency, you may have both tab
and mouseover
to change the button colour when focus is on the Form.
But you need to override low level Got, LostFocus events.
protected override void OnLostFocus(EventArgs e)
{
base.OnLostFocus(e);
}
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
}
- You may also try enter and leave events