简体   繁体   中英

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?

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM