简体   繁体   English

C#鼠标移动(WinForm)

[英]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? 创建此方法时如何操作:单击按钮时,鼠标光标将移至特定位置,然后在3秒钟后单击鼠标左键,然后在1秒钟后将光标移至其他位置?

Cursor.Position will get or set the position. Cursor.Position将获取或设置位置。 Check out the .NET Cursor class http://msdn.microsoft.com/en-us/library/sf27z138.aspx 查看.NET光标类http://msdn.microsoft.com/zh-cn/library/sf27z138.aspx

You can simulate clicks using mouse_event win32 API 您可以使用mouse_event win32 API模拟点击

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

How to get locations: 如何获取位置:

   Point FormLocation = this.Location;

   Point ButtonLocation = this.button1.Location;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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