![]() |
| | #1 |
| Registered User Join Date: Sep 2004
Posts: 27
| Looking at current mouse button state |
| Lifedragn is offline | |
| | #2 |
| Anti-Poster Join Date: Feb 2002
Posts: 1,222
| I don't think you can peek at the state of the mouse buttons. I think the mouse only transmits information when the mouse's state has changed and is incapable of responding to external queries. The events sounds like your best bet.
__________________ Rule #1: Every rule has exceptions |
| pianorain is offline | |
| | #3 |
| Registered User Join Date: Sep 2004
Posts: 27
| Unfortunate, but thank you anyway. |
| Lifedragn is offline | |
| | #4 |
| Registered User Join Date: Sep 2004
Posts: 27
| I just found a way to do it. For others searching for this in the future, here it is... If you are using System.Windows.Forms, there is a Control class which contains a Static MouseButtons property. This property gets the bitwise combination representing the mouse button states. if((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left) for example will check if the left mouse button is down. |
| Lifedragn is offline | |
| | #5 |
| Anti-Poster Join Date: Feb 2002
Posts: 1,222
| Nice...good info. You might want to consider what logical operator to use. For instance, ((Control.MouseButtons & MouseButtons.Left) != 0) returns true if the left mouse button is down, but others may be also. If you want to check to see if only the left mouse button is down, you could do ((Control.MouseButtons ^ MouseButtons.Left) == 0). However, your way works too.
__________________ Rule #1: Every rule has exceptions |
| pianorain is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looking for a way to store listbox data | Welder | C Programming | 20 | 11-01-2007 11:48 PM |
| 30something GSOH seeks help with the basics of a minor programme | promsan | C Programming | 3 | 05-13-2007 08:55 AM |
| Mouse Events | disruptor108 | C# Programming | 0 | 01-23-2007 11:40 PM |
| compiler build error | KristTlove | C++ Programming | 2 | 11-30-2003 10:16 AM |
| Mouse button outside of my app? | BubbleMan | Windows Programming | 1 | 10-01-2001 03:33 AM |