public static void Delays(int DelayTime = 100) { int time = Environment.TickCount; while (true) { if (Environment.TickCount - time >= DelayTime) { break; } Application.DoEvents(); Thread.Sleep(10); } } public static void Delay1(int milliSecond) { int start = Environment.TickCount; while (Math.Abs(Environment.TickCount - start) < milliSecond) { Application.DoEvents(); } } //延時程序 秒 public static bool Delay2(int delayTime) { DateTime now = DateTime.Now; int s; do { TimeSpan spand = DateTime.Now - now; s = spand.Seconds; Application.DoEvents(); } while (s < delayTime); return true; }