示例#1
0
 public void freezeBoard(bool enabled)
 {
     foreach (Control c in form.Controls)
     {
         Button b = c as Button;
         if (b != null)
         {
             form.Invoke(new Action(() => { b.Enabled = enabled; }));
         }
     }
 }
        private void createText(string winner)
        {
            Point   newLoc = new Point(1000, 300);
            TextBox b      = new TextBox();

            b.Text     = winner + " is the winner!";
            b.Size     = new Size(300, 50);
            b.Location = newLoc;
            b.Enabled  = false;
            //newLoc.Offset(0, b.Height + 5);
            gameArea.Invoke(new Action(() => { gameArea.Controls.Add(b); }));
        }