C#时间实时刷新

public Form1()
{
InitializeComponent();
new System.Threading.Thread(() =>
{
while (true)
{
try { label1.BeginInvoke(new MethodInvoker(() => label1.Text = DateTime.Now.ToString())); }
catch { }
System.Threading.Thread.Sleep(1000);
}
})
{ IsBackground = true }.Start();
}

posted @ 2017-08-21 14:29  水泽  阅读(3175)  评论(0编辑  收藏  举报