C#开发绿色倒计时软件 Count down 单一文件,30K..
<===============下载地址==============>
设置时间开始
随意停止
自动跳到前台提示
附代码:
TimeSpan ts = new TimeSpan(0, 0, 10); private void btStart_Click(object sender, EventArgs e) { ts = new TimeSpan(0, Convert.ToInt32(tbMinute.Text), Convert.ToInt32(tbSecond.Text)); this.TopMost = false; btStart.Enabled = false; timer1.Enabled = true; btReStart.Enabled = true; } private void timer1_Tick(object sender, EventArgs e) { ts = ts.Subtract(new TimeSpan(0, 0, 1));//每隔一秒减去一秒 btStart.Text = "【" + ts.Minutes.ToString() + "】Minutes\n【" + ts.Seconds.ToString() + "】Seconds"; if (ts.TotalSeconds <= 0.0)//当倒计时完毕 { this.TopMost = true; btStart.Enabled = true; timer1.Enabled = false; btStart.Text = "Start"; btReStart.Enabled = false; MessageBox.Show("Time over!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);//提示时间到 } } private void btReStart_Click(object sender, EventArgs e) { ts = new TimeSpan(0, 0, 0); }
<===============下载地址==============>
本文为博主原创文章,欢迎转载,但转载须注在明显位置注明【博客地址】和【原文地址】,否则将追究法律责任。http://www.cnblogs.com/cxd1008