问:时间控件的用法(C#制作倒计时)
如下代码:
目的在页面上实时显示当前倒计时信息,
时种控件timer1的属性:
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
DateTime Time1=DateTime.Now;
DateTime Time2=Convert.ToDateTime( "2007-08-07 ") ;
TimeSpan ReTime = Time2.Subtract(Time1);
Resultstr.Text= "还剩: "+ReTime.Days.ToString()+ "天 "+ReTime.Hours.ToString()+ "小时 "+ReTime.Minutes.ToString()+ "分 "+ReTime.Seconds.ToString()+ "秒 ";
}
按理这样就可以了,但为什么页面没反映,好像时钟控件没发挥作用
------解决方案--------------------用一种时间矫正的方法就好,js