Sign in to follow this  
danromeo

[.net] held mouse button

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this