实现效果:
知识运用:
DateTime结构的的Now属性
public DateTime Now { get; }
实现代码:
private void Form1_Load(object sender, EventArgs e) { thread = new Thread( () => { while(true) { Invoke((MethodInvoker)(()=> { toolStripStatusLabel1.Text= "当前时间: "+DateTime.Now.ToString("HH时mm分s秒"); })); Thread.Sleep(1000); } }); thread.IsBackground=true; thread.Start(); }