c#实现延时

 public static bool Delay(int delayTime)
        {
            DateTime now = DateTime.Now;
            int s;
            do
            {
                TimeSpan spand = DateTime.Now - now;
                s = spand.Seconds;
                Application.DoEvents();
            }
            while (s < delayTime);
            return true;
        }

注 : 已测试过,还有可能更进一步.

猜你喜欢

转载自blog.csdn.net/qq_39059405/article/details/85334290