/// <summary>Simulates the mouse. This can move the cursor, simulate holding a mouse button, and so on.</summary> /// <param name="x">The horizontal pixel coordinate to place the mouse cursor at.</param> /// <param name="y">The vertical pixel coordinate to place the mouse cursor at.</param> /// <param name="screenWidth">The current screen width (needed to scale the mouse cursor into position).</param> /// <param name="screenHeight">The current screen height (needed to scale the mouse cursor into position).</param> /// <param name="mouseOption">The mouse state to simulate.</param> public static void Simulate(int x, int y, int screenWidth, int screenHeight, VirtualMouseAction mouseOption) { NativeMethods.mouse_event((uint)mouseOption, (65535 * x / screenWidth), (65535 * y / screenHeight), 0, 0); }
protected virtual void OnVirtualMouseAction(MousePressedEventArgs e) { VirtualMouseAction?.Invoke(this, e); }