/// Pause to click timer void Timer_Tick(object sender, EventArgs e) { if (!doClick || useGripGesture) { return; } if (!alreadyTrackedPos) { timeCount = 0; return; } Point curPos = MouseControl.GetCursorPosition(); if (((lastCurPos - curPos).Length < pauseThresold) && ((timeCount += 0.1f) > timeRequired)) { MouseControl.DoMouseClick(); timeCount = 0; } else { timeCount = 0; } lastCurPos = curPos; }
/// <summary> ///点击暂停计时器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Timer_Tick(object sender, EventArgs e) { if (!doClick || useGripGesture) { return; } if (!alreadyTrackedPos) { timeCount = 0; return; } Point curPos = MouseControl.GetCursorPosition(); //光标落在按钮范围内 if ((lastCurPos - curPos).Length < pauseThresold) {//并且停留时间大于设置时间,实现点击事件 if ((timeCount += 0.1f) > timeRequired) { //MouseControl.MouseLeftDown(); //MouseControl.MouseLeftUp(); MouseControl.DoMouseClick(); timeCount = 0; } } else { timeCount = 0; } lastCurPos = curPos; }