日期:2014-05-19  浏览次数:21007 次

小弟初学 请教 C# 倒计时器怎么写 时间是用户输入
using   System;
using   System.Collections.Generic;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Text;
using   System.Windows.Forms;

namespace   WindowsApplication7
{
        public   partial   class   Form1   :   Form
        {
                private   int   second   =   0;

                public   Form1()
                {
                        InitializeComponent();
                }

                private   void   button1_Click(object   sender,   EventArgs   e)
                {
                        second   =   Convert.ToInt32(textBox1.Text);
                }

                private   void   timer1_Tick(object   sender,   EventArgs   e)
                {
                        if   (second   >   0)
                        {
                                label1.Text   =   second.ToString();
                                second--;
                        }
                }
        }
}

怎么改啊

------解决方案--------------------
button1_Click中加上
this.timer1.Interval = 1000;
this.timer1.Enabled = true;