public static void MouseClick(int x, int y, int nFlags) // nFlag hint whether 'Shift' 'Control' pressed { if (nFlags == 0) //'Shift' been pressed { SUIKeyboard.Press(SUI.Base.Win.SUIKeyboard.VK.SHIFT); MouseClick(x, y); SUIKeyboard.Release(SUI.Base.Win.SUIKeyboard.VK.SHIFT); } else if (nFlags == 1) // 'Control' been pressed { SUIKeyboard.Press(SUI.Base.Win.SUIKeyboard.VK.CONTROL); MouseClick(x, y); SUIKeyboard.Release(SUI.Base.Win.SUIKeyboard.VK.CONTROL); } else if (nFlags == 2) // 'Alt' been pressed { SUIKeyboard.Press(SUI.Base.Win.SUIKeyboard.VK.MENU); MouseClick(x, y); SUIKeyboard.Release(SUI.Base.Win.SUIKeyboard.VK.MENU); } else if (nFlags == 3) //double click action { MouseClick(x, y); SUISleeper.Sleep(50); MouseClick(x, y); } else { MouseClick(x, y); } }
public static void MouseDrag(int xStart, int yStart, int xEnd, int yEnd) { MouseMove(xStart, yStart); SUISleeper.Sleep(500); SUIWinAPIs.mouse_event((uint)(MouseEventFlags.ABSOLUTE | MouseEventFlags.LEFTDOWN), (uint)xStart, (uint)yStart, 0, 0); SUISleeper.Sleep(500); MouseMove(xEnd, yEnd); SUISleeper.Sleep(500); SUIWinAPIs.mouse_event((uint)(MouseEventFlags.ABSOLUTE | MouseEventFlags.LEFTUP), (uint)xEnd, (uint)yEnd, 0, 0); SUISleeper.Sleep(500); }
public static void MouseDoubleClick(int x, int y, bool NeedTransfer) { if (NeedTransfer) { PixelsToAbsNormalCoors(x, y, ref x, ref y); } MouseClick(x, y, false); int interval = (int)Math.Round((double)(((double)SystemInformation.DoubleClickTime) / 3)); interval = interval < 50 ? interval : 50; SUISleeper.Sleep(interval); MouseClick(x, y, false); }