System.Timers.Timer timer = null;
private void InitStatusInfo()
{
string uName = this.Tag.ToString();
lblLoginUser.Text = uName;
//时间 动态时间条--- 计时器 (Timers.Timer)
lblLoginTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.AutoReset = true;
timer.Elapsed += Timer_Elapsed;
timer.Start();
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
this.Invoke(new Action(() =>
{
this.lblLoginTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}));
}
11-01
181
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-25
291
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-21
171
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-10
408
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-09
363
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-08
267
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-04
224
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-03
175
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)