简体   繁体   English

鼠标单击C#

[英]Mouse click in c#

I want to simulate a simple left mouse click that would be "pressed" after 5 seconds I clicked a simple button form. 我想模拟一个简单的鼠标左键单击,单击5秒钟后将“按下”。 enter link description here 在此处输入链接说明

I tried that way but it didn't work. 我尝试过这种方法,但是没有用。 Couldn't things be simplier?(sry I'm new here) 事情不会简单吗(对不起,我是新来的)

Unfortunately for a relatively low level operation like this, you'll have import the user32 WinAPI dll and do exactly what the answers in your link suggested. 不幸的是,对于这样的较低级别的操作,您将导入user32 WinAPI dll并完全按照您的链接所建议的答案进行操作。 The only simpler thing to do is to use a library someone else built that wraps around the WinAPI, like http://inputsimulator.codeplex.com/ as suggested in this answer: 唯一更简单的方法是使用其他人构建的环绕WinAPI的库,例如此答案中建议的http://inputsimulator.codeplex.com/

https://stackoverflow.com/a/15146334/3063835 https://stackoverflow.com/a/15146334/3063835

It's not 100% clear from your question, but this is all assuming you want an actual "click" message to be sent to your form. 目前尚不清楚您的问题是否100%明确,但这都是假设您希望将实际的“点击”消息发送到您的表单。 If you just want to simulate a click event on a control in your form, you can always just call the click event handler when appropriate! 如果只想在表单中的控件上模拟click事件,则始终可以在适当的时候调用click事件处理程序!

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

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