Ejemplo n.º 1
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     if (objAction != null)
     {
         objAction.ClearSnake();
     }
     objSnake = new Snake();                     //snake.cs中的Snake类的引用
     objAction = new Action(panel, objSnake);        //Action.cs中Action类的重载,方便在panel上画蛇身
     objAction.InitializeSnake();                //调用蛇身的初始化函数
     start = true;
     timer.Enabled = true;
     this.btnStart.Enabled = false;
     this.btnHelp.Enabled = false;
 }
Ejemplo n.º 2
0
 public Action(System.Windows.Forms.Panel panel, Snake snake)//为什么要对两个参数进行重载
 {                               //如果不重载则不能在MainForm上的panel上画图 
     objPanel = panel;
     objSnake = snake;
 }