DateTime startTime;
Start()
{
 startTime = DateTime.Now;
}timer_tick()
{
   //check in timer_tick or other method
   TimeSpan span = DateTime.Now - startTime;
   if (span.Minutes > 60)
   {
        Stop();
   }
}

解决方案 »

  1.   

    <script language="javascript">
    function shengyushijian()
    {
    ......
    }
    setinterval(shengyushijian);
    </script>
      

  2.   

          private void button1_click(object sender, EventArgs e)
            {
                        timer1.Enabled = true;
                        timer1.Interval = 1000;
                        second = Convert.ToInt32(textBox2.Text) * 60;
           } 
           private void timer1_Tick(object sender, EventArgs e)
            {
                // label5.Text = (Convert .ToInt32( textBox2 .Text)*60 - 1).ToString ();
                if (second >= 0)
                {
                    label7.Text = second.ToString();
                    second--;
                    if (second == 5)
                    {
                        MessageBox.Show("时间到.请交试卷");
                    }
                    if (second == 0)
                    {
                        button2.Enabled = false;
                        //button2.Visible = false;
                    }
                }
            }
      

  3.   

    可不可以换中思考方式,那就是不管你在这一个小时内如何刷新都是那些题目?hoho~
      

  4.   

    禁止F5和菜单 刷新<script type="text/javascript">     function document.onkeydown()   
              {if(event.keyCode==116)   
                          {event.keyCode=0   
                              event.returnValue=false;   
                          }   
              }   
        
              document.oncontextmenu=function(){return   false}     </script>
      

  5.   

    用AJAX实时获取服务器端时间再用程序来实现倒计时.