一、使循环不卡
Application.DoEvents();
System.Threading.Thread.Sleep(5);
二、计算代码运行时间
Stopwatch sw = new Stopwatch();
sw.Start();
...
sw.Stop();