title: Change button back color after click, and change it back after 2nd click and so on
body: <p>hi guys i am create 10 button and add my panel. its works. I want to change the button.background color when I click again on the button and I want the same color to turn. tha</p>
  
  <pre><code>  private void Form1_Load(object sender, EventArgs e)
      { for (int i = 0; i &lt; 10; i++)
          {
              Button button = new Button();
              button.Size = new Size(43, 43);
              button.Tag = i;
              button.Click += new EventHandler(ButtonClickOneEvent);
             button.Location = new Point(60, 60 + (i * 50));
            }
              this.panel1.Controls.Add(button);
          }
      }
  
      void ButtonClickOneEvent(object sender, EventArgs e)
      {
          MouseEventArgs me = (MouseEventArgs)e
          Button button = sender as Button;
          if (button != null)
          {
              switch ((int)button.Tag)
              {
                  case 0:
                      if (me.Clicks &gt;= 2)
                      { 
                          button.BackColor = Color.White;
                      }
                      else
                      {
                          button.BackColor = Color.Red;
                      }
                      break;
                  case 1:
                      button.BackColor = Color.Red;
                      break;
                  case 3:
                      button.BackColor = Color.Red;
                      break;
              }
          }
  
      }
  </code></pre>