title: Why ActivateButton works and DisableButton does not work
body: <p>This is the code that changes the color of the button when we click on it, but this code should work like this, when you press the first button it should turn blue.</p>
  <p>When you also press the second button, the first button should turn white and then the second button turn blue, but when you press the first button it Turns blue.</p>
  <p>When I press the second button it shows both blue and I think here only the disablebutton function does not work and help me if you can.</p>
  <p>I am using the following code:</p>
  <pre><code>private void ActivateButton(object btnSender)
  {
          if (btnSender != null)
          {
              if (currentButton != (Button)btnSender)
              {
                  DisableButton();
                  Color color = Color.Blue;  //SelectThemeColor()
                  currentButton = (Button)btnSender;
                  currentButton.BackColor = color;
                  currentButton.ForeColor = Color.White;
                  currentButton.Font= new System.Drawing.Font(&quot;Microsoft YaHei&quot;, 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              }
          }
      }
  </code></pre>
  <p>This is not working</p>
  <pre><code>private void DisableButton()
  { 
          foreach (Control previousButton in panelMenu.Controls)
          {
              if (previousButton.GetType() == typeof(Button))
              {
                  previousButton.BackColor = Color.FromArgb(51,51,76);
                  previousButton.ForeColor = Color.Gainsboro;
                  previousButton.Font = new System.Drawing.Font(&quot;Microsoft YaHei&quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              }
          }
  }
  </code></pre>
  <p>And why does my <code>DisableButton</code> not work? Please help me</p>
  <p><img src="https://i.stack.imgur.com/WiJ7u.png" alt="" />
  <img src="https://i.stack.imgur.com/r0sat.png" alt="" /></p>