1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Thread update; public Form1() { InitializeComponent(); update = new Thread(UpdateFunc); }
void UpdateFunc() { while (true) { Invoke(()=> label1.Text = DateTime.Now.ToString("HH:mm:ss")); Invoke((string x)=> label1.Text = x + DateTime.Now.ToString("HH:mm:ss"),"时间:"); Thread.Sleep(500); } }
|