手写定时器

 ///


        /// 关键代码
        ///

        ///
        [System.Runtime.InteropServices.DllImport("kernel32.dll")]
        static extern uint GetTickCount();
        static void Delay(uint ms)
        {
            uint start = GetTickCount();
            while (GetTickCount() - start < ms)
            {
                Application.DoEvents();
            }
        }

转载于:https://www.cnblogs.com/aaaaq/p/4542919.html

你可能感兴趣的:(手写定时器)