c#中Stopwatch计时器的使用

        private void button3_Click(object sender, EventArgs e)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            Thread.Sleep(3000);
            sw.Stop();
            MessageBox.Show(sw.ElapsedMilliseconds.ToString());
            sw.Start();
            Thread.Sleep(3000);
            sw.Stop();
            MessageBox.Show(sw.ElapsedMilliseconds.ToString());
        }

参考:https://www.cnblogs.com/change-myself/p/11130381.html

posted @ 2021-07-16 16:00  masha2017  阅读(266)  评论(0编辑  收藏  举报