Shay Sandler
Shay Sandler

Reputation: 109

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?

Upvotes: 1

Views: 990

Answers (1)

Steve
Steve

Reputation: 216363

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

Upvotes: 3

Related Questions