Click here to Skip to main content
15,921,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi how can i make a button apparence like a debugg(F5) button .When mouse or button got focussed the back side apparance should be yellow.and while lose focus it should same like before
Posted
Comments
StM0n 19-Jul-13 6:40am    
So you would like to highlight a button by a mouse over?

* WinForm?
* HTML?
* WPF?
* ...?

you need to use the events Enter And Leave for the button :
On Enter change to yellow and on Leave return as it was

C#
private void button1_Enter(object sender, EventArgs e)
     {
         button1.BackColor = Color.Yellow;
     }

     private void button1_Leave(object sender, EventArgs e)
     {
         button1.BackColor = SystemColors.Control;
     }


Hope it will help.
 
Share this answer
 
Comments
lakshmichawala 19-Jul-13 14:10pm    
Hi jokler.007 thanks for ur response ...but it is working when click event happened on the button .but the requirement here is for example if we place mouse on >(execute)button the back ground appears yellow.in that way it should come.
[no name] 19-Jul-13 15:07pm    
I am not getting what you need exactly, if you need on mouse event to change color use this :
private void button1_MouseEnter(object sender, EventArgs e)
{
button1.BackColor = Color.Yellow;//change the button color
}

private void button1_MouseLeave(object sender, EventArgs e)
{
button1.BackColor = SystemColors.Control;//return to normal color before changing
}
You need to use Focus Events for this

Events -> Focus Section

Enter
Leave

These two events are need to use


Thanks,
 
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