public static void Delay(int ms)
{
int start = System.Environment.TickCount;
while (System.Environment.TickCount - start < ms)
{
//调用此方法将导致当前线程暂停,但处理所有等待窗口消息。
Application.DoEvents();
}
}