在状态栏中显示当前系统时间

实现效果:

  

知识运用:

  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();
        }
原文地址:https://www.cnblogs.com/feiyucha/p/10178183.html