FlowLayout 控件事件

FlowLayout Controls Events

FlowLayout 中有很多按钮。当我点击按钮时,我希望改变正常的颜色。当我第一次点击时,按钮的颜色会改变。这里没有问题,但是当我第二次点击另一个按钮时,我之前点击的按钮没有恢复。我该怎么办?

 int j =1;
    foreach (...)
                 {
                     BunifuFlatButton newButton = new BunifuFlatButton();
                     {
                         newButton.Name = string.Format("Button{0}", j);
                         flowLayoutPanel1.Controls.Add(newButton);
                         newButton.Click += NewButtonOnClick;
                         j++;
                     }

                 }




  private void NewButtonOnClick(object sender, EventArgs eventArgs)
        {
            BunifuFlatButton btn = (BunifuFlatButton)sender;
            btn.Normalcolor = Color.FromArgb(37, 66, 80);
        }
  List<BunifuFlatButton> btnss = new List<BunifuFlatButton>();
    private bool pressed = false;
    private void NewButtonOnClick(object sender, EventArgs eventArgs)
    {
        BunifuFlatButton btn = (BunifuFlatButton)sender;
        if (pressed)
        {
            btnss[0].Normalcolor = Color.FromArgb(37, 37, 37);
            btn.Normalcolor = Color.FromArgb(37, 66, 80);
            pressed = false;
            btnss.Clear();
            btnss.Add(btn);
        }
        else
        {
            if (btnss.Count != 0)
            {
                btnss[0].Normalcolor = Color.FromArgb(80, 80, 80);

            }
            btn.Normalcolor = Color.FromArgb(37, 66, 80);
            btnss.Clear();
            btnss.Add(btn);
            pressed = true;
        }

}