本文實例講述了C#實現程序等待延遲執行的方法。分享給大家供大家參考。具體如下:
[System.Runtime.InteropServices.DllImport("kernel32.dll")]static extern uint GetTickCount();/// <summary>/// 程序等待延遲執行/// </summary>/// <param name="ms"></param>static void MySleep(uint ms){  uint start = GetTickCount();  while (GetTickCount() - start < ms)  {    Application.DoEvents();  }}希望本文所述對大家的C#程序設計有所幫助。
新聞熱點
疑難解答