private void OnKeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F12) { switch (_step) { case 0: _step = 1; _lastPoint = new Point(Cursor.Position.X, Cursor.Position.Y); Log(string.Format("{0},{1}\r\n", _lastPoint.X, _lastPoint.Y)); Log("等待点击第二个点:"); break; case 1: _step = 0; Point currentPoint = new Point(Cursor.Position.X, Cursor.Position.Y); Log(string.Format("{0},{1}\r\n", currentPoint.X, currentPoint.Y)); int time = _distanceCalculator.CalculateTime(currentPoint, _lastPoint); Log(string.Format("按压时间为:{0}ms\r\n", time)); _mouseClicker.Click(_lastPoint, time); Log("等待点击第一个点:"); break; default: break; } } }