By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Press two mouse buttons at the same time

P: 2
I want to detect when MouseButtons.Right MouseButton.Middle are pusheds at the same time.

I have this
Expand|Select|Wrap|Line Numbers
  1.  
  2. private void SceneView_MouseMove(object sender, MouseEventArgs e)
  3. {
  4. vMouseOld.x = vMouse.x;
  5. vMouseOld.y = vMouse.y;
  6. vMouse.x = e.X;
  7. vMouse.y = e.Y - toolStrip1.Size.Height;
  8.  switch (e.Button) 
  9.             {
  10.                 case  MouseButtons.Right:   camera.yaw((vMouse.x - vMouseOld.x) * 0.01f);      
  11.                                    camera.pitch((vMouse.y - vMouseOld.y) * 0.01f);
  12.  
  13.                         break;
  14.                 case MouseButtons.Middle:   camera.strafe((vMouse.x - vMouseOld.x) * 0.01f);
  15.                                             camera.up((vMouse.y - vMouseOld.y) * 0.01f);
  16.                                                                                  break;
  17.  default: break;
  18.  
  19.             }
  20. }
  21.         {
And I want to add another case when both buttons are pressed.

Thank you.
Jun 24 '11 #1
Share this Question
Share on Google+
1 Reply


P: 2
I get it.

I added a new case.
Expand|Select|Wrap|Line Numbers
  1. case MouseButtons.Right | MouseButtons.Middle:
Sorry was so easy.
Thank you.
Jun 24 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.