Stopwatch 类GotFocus 事件 中 StopWatch.Start();LostFocus 事件 中 StopWatch.Stop()// Get the elapsed time as a TimeSpan value. TimeSpan ts = stopWatch.Elapsed;// Format and display the TimeSpan value. labelTime.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds/10);
TimeSpan ts = stopWatch.Elapsed;// Format and display the TimeSpan value.
labelTime.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds/10);