static public void WaitFor(int ms) { DateTime time = DateTime.Now; while (true) { Application.DoEvents(); TimeSpan span = DateTime.Now - time; if (span.TotalMilliseconds > ms) break; } }
消耗资源严重,不建议使用