简体   繁体   中英

How to simulate mouseclick from the code?

I want to get mouse click events on Windows form (just right click) and send them to the server so when it will read them, it will preform mouse clicks.
I couldn't find event that indicates right mouse click.
From all the information online I didn't understand all the 0*02 things and how it relates to simulating a mouse click.

How i can indicate if it was a right click or left?

There isn't a separate event for right/left/other mouse click. There is only a MouseClick event. But a MouseClick event is a delegate of type MouseEventHandler , a MouseEventHandler receives an argument e of type MouseEventArgs , a MouseEventArgs instance has a property named Button of type MouseButtons enumeration, here you can find what kind of button has been pressed. In the link above a lot of examples how to use these infos.

This should answer your question, but the remainder of your problem (passing this information to a remote server) is totally unclear

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