Testing on mouse buttons without events.

  • Thread starter Thread starter Olaf Baeyens
  • Start date Start date
O

Olaf Baeyens

Is there a way in the .NET framework to determin if a key is pressed and if
a mouse button is pressed withou need of events?
I need this in an OpenGL project, while the scene is rendered I want to see
if the left mouse button is pressed and/or if a key is pressed before
rendering my scene.

I could of course use the events version but I don't like to make my code
complicated by passing on the states als booleans.

--
 
Hi Olaf,

Use the static Control.ModifierKeys and Control.MouseButtons to check the status outside an event.
 
Use the static Control.ModifierKeys and Control.MouseButtons to check the
status outside an event.Fantastisc! :-)
I believe it is used something like this?

if ((System.Windows.Forms.Control.MouseButtons &
System.Windows.Forms.MouseButtons.Left)!=0) {
OnRotate(this,RotationEnum.RotateLeft);
}
 
Indeed

Fantastisc! :-)
I believe it is used something like this?

if ((System.Windows.Forms.Control.MouseButtons &
System.Windows.Forms.MouseButtons.Left)!=0) {
OnRotate(this,RotationEnum.RotateLeft);
}
 
Back
Top