手写定时器

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

posted @ 2015-05-31 23:02  罗曼蒂克'  阅读(276)  评论(0编辑  收藏  举报