0x29A
0x29A

Reputation: 941

C# Mouse Movement (WinForm)

I'm stuck trying to figure out how to do this, and I'm in need of some help.

How would you go upon creating this: When you click on a button, the mouse cursor will move to a specific location and then after 3 seconds it will left click and then after 1 second it moves the cursor to a different location?

Upvotes: 0

Views: 1164

Answers (1)

Josh Dean
Josh Dean

Reputation: 1593

Cursor.Position will get or set the position. Check out the .NET Cursor class http://msdn.microsoft.com/en-us/library/sf27z138.aspx

You can simulate clicks using mouse_event win32 API

http://msdn.microsoft.com/en-nz/library/windows/desktop/ms646260%28v=vs.85%29.aspx

How to get locations:

   Point FormLocation = this.Location;

   Point ButtonLocation = this.button1.Location;

Upvotes: 1

Related Questions