- /// <summary>
- /// 延时函数
- /// </summary>
- /// <param name="delayTime">需要延时多少秒</param>
- /// <returns></returns>
- 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;
- }
- //该片段来自于http://www.codesnippet.cn/detail/1901201614458.html
来源: http://www.codesnippet.cn/detail/1901201614458.html