日期:2014-05-18 浏览次数:20961 次
private bool isPressed; public static long time; public static long timePassed; private void button2_Click(object sender, EventArgs e) { if (isPressed) { time = Environment.TickCount - timePassed; timePassed = Environment.TickCount; } else { isPressed = true; time = 0; timePassed = Environment.TickCount; } MessageBox.Show("距离上一次单击该按钮时隔:" + time.ToString() + "毫秒"); }