Move the mouse through code.

Dre__

Newcomer
Joined
Mar 12, 2010
Messages
4
How can I move the mouse using code. Say I click Command1, the mouse would move a certain number of units.

Where can I find a tutorial on how to do this?
 
Found this solution on Google. You can set the cursor's position using the Cursor class' Position property. For example, this function would move the mouse:
Code:
[COLOR="Blue"]void[/COLOR] MoveMouse([COLOR="Blue"]int [/COLOR]x, [COLOR="Blue"]int [/COLOR]y) {
    Cursor.Position = [COLOR="Blue"]new [/COLOR]Point(Cursor.Position.X + x, Cursor.Position.Y + y);
}
 
Back
Top