I have a doubt in windows application
my doubt is
I have created a winform
for example
with two text boxes and two buttons
i have two different colours for two buttons
my question is if I click on a button, the colour of the button should be reflected on to the background
like if I click on blue button the background should become blue..
How to do this give me example with code???
Thank u
chaithu
Windows application
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

AlanRank #669 · 3.6K reputationPosted Aug 4, 2008, 12:45 AM EDT
private void btnBlue_Click(object sender, EventArgs e)
{
this.BackColor = btnBlue.BackColor;
}
Sunny Chen162 reputationPosted Aug 4, 2008, 10:23 PM EDT
1. Defines a common function like this:
private void OnButtonClick(object sender, System.EventArgs e)
{
if (sender is Button)
this.BackColor = (sender as Button).BackColor;
}
2. Binds the Click event to the above function on all buttons.