How to programatically trigger a mouse left click in C#?

后端 未结 3 1314
不知归路
不知归路 2020-12-05 16:43

How could I programmatically trigger a left-click event on the mouse?

Thanks.

edit: the event is not triggered directly on a button. I\'m aiming for the Wind

3条回答
  •  [愿得一人]
    2020-12-05 17:19

    If it's right on a button, you can use

    button1.PerformClick();
    

    Otherwise, you can check out this MSDN article which discusses simulating mouse (and keyboard) input.

    Additionally, this project may be able to help you out as well. Under the covers, it uses SendInput.

提交回复
热议问题