예제 #1
0
 //开始按钮的Click事件
 private void BtnStart_Click(object sender, EventArgs e)
 {
     PicBoxCell.Width  = (int)(this.Width * 0.8);
     PicBoxCell.Height = (int)(this.Width * 0.8);
     if (game == null)
     {
         game = new Game(Convert.ToInt32(NumericCell.Value), Convert.ToInt32(NumericCell.Value));
         if (RadBtnRand.Checked == true)
         {
             game.Rand();
         }
         if (RadBtnOne.Checked == true)
         {
             if (Convert.ToInt32(NumericCell.Value) < 40)
             {
                 game = new Game(40, 40);
             }
             game.StyleOne();
         }
         if (RadBtnTwo.Checked == true)
         {
             if (Convert.ToInt32(NumericCell.Value) < 40)
             {
                 game = new Game(40, 40);
             }
             game.StyleTwo();
         }
         if (RadBtnThree.Checked == true)
         {
             if (Convert.ToInt32(NumericCell.Value) < 40)
             {
                 game = new Game(40, 40);
             }
             game.StyleThree();
         }
     }
     BtnPause.Enabled   = true;
     generation.Enabled = true;
     BtnStop.Enabled    = true;
     BtnStart.Enabled   = false;
     show();
     NumericCell.Enabled = false;
 }