private mouse_event ( int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo ) : void | ||
dwFlags | int | |
dx | int | |
dy | int | |
cButtons | int | |
dwExtraInfo | int | |
return | void |
/// Simulates a right button double click at the current /// cursor position public static void SimulateRightMouseDoubleClick() { int mouseX = Cursor.Position.X; int mouseY = Cursor.Position.Y; User32Interop.mouse_event(User32Interop.MOUSEEVENTF_RIGHTDOWN | User32Interop.MOUSEEVENTF_RIGHTUP, mouseX, mouseY, 0, 0); User32Interop.mouse_event(User32Interop.MOUSEEVENTF_RIGHTDOWN | User32Interop.MOUSEEVENTF_RIGHTUP, mouseX, mouseY, 0, 0); }
/// <summary> /// Simulates a middle button double click at the current /// cursor position /// </summary> public static void SimulateMiddleMouseDoubleClick() { int mouseX = Cursor.Position.X; int mouseY = Cursor.Position.Y; User32Interop.mouse_event(User32Interop.MOUSEEVENTF_MIDDLEDOWN | User32Interop.MOUSEEVENTF_MIDDLEUP, mouseX, mouseY, 0, 0); User32Interop.mouse_event(User32Interop.MOUSEEVENTF_MIDDLEDOWN | User32Interop.MOUSEEVENTF_MIDDLEUP, mouseX, mouseY, 0, 0); }
/// <summary> /// Simulates a right mouse drag at the current /// cursor position by sending a right button down event /// </summary> public static void SimulateRightMouseDrag() { User32Interop.mouse_event(User32Interop.MOUSEEVENTF_RIGHTDOWN, Cursor.Position.X, Cursor.Position.Y, 0, 0); }
/// <summary> /// Simulates a middle button drag at the current /// cursor position by sending a middle button down event /// </summary> public static void SimulateMiddleMouseDrag() { User32Interop.mouse_event(User32Interop.MOUSEEVENTF_MIDDLEDOWN, Cursor.Position.X, Cursor.Position.Y, 0, 0); }
/// <summary> /// Simulates a left click at the current /// mouse position /// </summary> public static void SimulateLeftMouseClick() { User32Interop.mouse_event(User32Interop.MOUSEEVENTF_LEFTDOWN | User32Interop.MOUSEEVENTF_LEFTUP, Cursor.Position.X, Cursor.Position.Y, 0, 0); }