计算机 曾加倒计时

namespace WindowsFormsApplication1 {

    public partial class Form1 : Form     {     

    public Form1()     

    {           

  InitializeComponent();     

    }   

      public static int count = 0;   

      private int t = 60;    

     public static int right = 0;   

      public int result;   

      private void button5_Click(object sender, EventArgs e)     

    {           

       label2.Text=t.ToString();         

        timer1.Enabled = true;       

        timer1.Interval = 1000;    

        timer1.Start();      

        Random();

        }     

        private void Random()    

      {       

      Random ab = new Random();

            int a, b;     

        a = ab.Next(1, 11);      

       b = ab.Next(1, 11);     

        textBox1.Text = a.ToString();      

       textBox2.Text = b.ToString();      

       textBox3.Text = "";      

       count++;  

        }    

     private void timer1_Tick(object sender, EventArgs e)    

     {         

    if (t <= 0)        

     {          

       timer1.Enabled = false;        

         textBox3.Enabled = false;      

           MessageBox.Show("时间到!");      

           textBox3.Enabled = false;            

}      

       t = t - 1;       

      label2.Text = t.ToString();

       }

        private void button1_Click(object sender, EventArgs e)   

      {      

       label3.Text = "+";     

    }

        private void button2_Click(object sender, EventArgs e)   

      {      

       label3.Text = "-";     

    }

        private void button3_Click(object sender, EventArgs e)    

     {         

    label3.Text ="*";     

    }

        private void button4_Click(object sender, EventArgs e)   

      {        

     label3.Text = "/";   

      }

        private void textBox3_KeyDown(object sender, KeyEventArgs e)  

       {                

         if (e.KeyCode == Keys.Enter)      

       {          

       switch (label3.Text)         

        {           

          case "+":         

                result = int.Parse(textBox1.Text) + int.Parse(textBox2.Text);           

              break;          

           case "-":           

              result = int.Parse(textBox1.Text) - int.Parse(textBox2.Text);            

             break;          

           case "*":               

          result = int.Parse(textBox1.Text) * int.Parse(textBox2.Text);             

            break;            

         case "/":             

            result = int.Parse(textBox1.Text) / int.Parse(textBox2.Text);          

               break;             

             }                              

                       if (textBox3.Text == result.ToString())              

               {

                                right++;          

                   }                 

            Random();

                        }        

         }                        

        private void button6_Click(object sender, EventArgs e)   

      {         

    textBox3.Enabled = false;      

       Form2 frm2 = new Form2();       

      frm2.ShowDialog();    

     }       

   }

}

psp    
  计划 10m
  估计这个任务需要的时间 3h
  开发 40m
  需求分析 10m
  生成设计文档 10m
  设计复审 6m
  代码规范 6m
  具体设计 20m
  具体编码 2h
  代码复审 30m
  测试 5m
  报告 5m
  测试报告 10m
  计算工作量 10m
  事后总结 5m

经过我和殷太平的努力  包括从书上找的代码  经过不少时间完成了倒计时  但是并不算完美,倒计时只能设定不能够让用户自定义计时的时间,还有老师给的一些增量有的我们有点思路但是真正实现感觉有些吃力,不过两个人总好过一个人在那无聊的扣代码。

 

posted @ 2015-10-17 17:06  夏yongyong  阅读(194)  评论(1编辑  收藏  举报