hi, i was wondering if anyone could help me? i am trying to have a button once clicked to display a colour, i have managed to this with the code,
private void button1_Click(object sender, EventArgs e)
{ button1.BackColor = Color.Green; }
i want to know now that the button is green from the first click am i able to create an if statement to detect whether the button is green then to continue to the next method if it is?
many thanks in advance :)
Help with color and buttons?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted May 13, 2015, 7:51 AM EDT
if (button1.BackColor != Color.Green)
button1.BackColor = Color.Green;
else
//Your Method call
Dipankar BiswasRank #992 · 2K reputationPosted May 13, 2015, 4:50 AM EDT
u can try it...
private void button1_Click(object sender, EventArgs e)
{
button1.BackColor = Color.Red;
if (button1.BackColor == Color.Red)
{
label1.Text = "You";
}
else
{
label1.Text = "Me";
}
}