解决方案 »

  1.   

    点重置按钮时加上一句代码this.timerSetTime.Tick -= new EventHandler(timerSetTime_Tick);解除事件绑定,否则开始按钮中会重复绑定多次
      

  2.   

    问题在this.timerSetTime.Tick += new EventHandler(timerSetTime_Tick);这句
    这是给委托添加方法,如果没有去掉,会一直往上加,执行的时候会执行委托的所有方法,你可以在你代码中加两句这行代码试试,
    解决方法:1:楼上可以解决
                      2:在重置按钮buttonSetTimeReset_Click 中加上this.timerSetTime.Tick -= new EventHandler(timerSetTime_Tick);
      

  3.   

    楼上说的都是对的,不过其实如果你只需要一个timer,而不需要代码创建多个timer,放到load里就好了,这句
    this.timerSetTime.Tick += new EventHandler(timerSetTime_Tick)
    然后按钮里就只是控制start和stop,不要再来回绑定事件,解除事件了
      

  4.   

    点选按钮实现任务到计时
    //提示10分钟准备倒计时
     // 定义在线考试总时间变量index,
        // 并设置读写属性
        private int index
        {
            get
            {
                object o = ViewState["index "];
                return (o == null) ? 600 : (int)o;
            }
            set
            {
                ViewState["index "] = value;
            }
        }//codego.net/tags/11/1/
    //计算剩余时间提示
     protected void Timer1_Tick(object sender, EventArgs e)
        {
            this.index--;
            if (this.index == 0) //考试时间到了
            {
                this.Timer1.Enabled = false;//设置Timer控件不可见
                //时间到时,此处可编写自动提交试卷的方法
            }
            else
            {
                //显示考试剩余时间
                this.lbTime.Text = this.index / 60 + "分" + this.index % 60 + "秒将停止考试,请及时“提交”试卷,否则试卷作费成绩无效!";
            } 
        }
      

  5.   


    那么如果我启用2个以上的Timer
    C#会自动做安全工作么?两个线程会不会互相影响?
      

  6.   


    那么如果我启用2个以上的Timer
    C#会自动做安全工作么?两个线程会不会互相影响?
    多个timer会不会有影响得看
    在timer中处理的数据是不是共享的,如果没有关联
    那肯定是安全的
    线程是一样的道理
      

  7.   

    弄一个timer,控制Enabled就好了,不要了再Close
      

  8.   

    明显是timer的tick事件重复执行了。