C# 程序等待延时

        [System.Runtime.InteropServices.DllImport("kernel32.dll")]
        static extern uint GetTickCount();
        ///
        /// 程序等待延迟执行
        ///

        ///
        static void MySleep(uint ms)
        {
            uint start = GetTickCount();
            while (GetTickCount() - start < ms)
            {
                Application.DoEvents();
            }
        }

你可能感兴趣的:(C#)