How do I detect if both left and right buttons are pushed?
- by Greg McGuffey
I would like have three mouse actions over a control: left, right and BOTH.
I've got the left and right and am currently using the middle button for the third, but am curious how I could use the left and right buttons being pressed together, for those situations where the user has a mouse without a middle button. This would be handled in the OnMouseDown method of a custom control.
UPDATE
After reviewing the suggested answers, I need to clarify that what I was attempting to do was to take action on the mouse click in the MouseDown event (actually OnMouseDown method of a control). Because it appears that .NET will always raise two MouseDown events when both the left and right buttons on the mouse are clicked (one for each button), I'm guessing the only way to do this would be either do some low level windows message management or to implement some sort of delayed execution of an action after MouseDown. In the end, it is just way simpler to use the middle mouse button.
Now, if the action took place on MouseUp, then Gary's or nos's suggestions would work well.
Any further insights on this problem would be appreciated. Thanks!