[.net] held mouse button

Started by
0 comments, last by Agony 17 years, 1 month ago
I'm writing a VR app in C# and I want the user to walk forward when holding down the right mouse button. Using MouseDown and then polling for which button is pushed doesn't work because it would require the user to continuously push the button. MouseHover doesn't work because it takes a SystemEvent arguement and can't poll for which button is pushed. MouseMove doesn't work because I need this functionality even if the mouse hasn't moved. What's the best way to detect a "held" mouse button? Sorry for the stupid question, but somebody's gotta ask 'em, dammit.
Advertisement
I might personally just catch MouseDown and MouseUp events, and manually track the mouse's state myself. Capturing the mouse can help with this, too.

Another option might be to use the static property System.Windows.Forms.Control.MouseButtons, perhaps along with the ModifierKeys and MousePosition properties as well.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke

This topic is closed to new replies.

Advertisement