How to: Simulate Mouse and Keyboard Events in Code
Windows Forms provides several options for programmatically simulating mouse and keyboard input. This topic provides an overview of these options. Simulating Mouse Input The best way to simulate mouse events is to call the OnEventName method that raises the mouse event you want to simulate. This option is usually possible only within custom controls and forms, because the methods that raise events are protected and cannot be accessed outside the control or form. For example, the following steps illustrate how to simulate clicking the right mouse button in code. To programmatically click the right mouse button Create a MouseEventArgs whose […]
Read more