Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Testing on mouse buttons without events.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Olaf Baeyens - 16 Aug 2005 12:13 GMT
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.
Morten Wennevik - 16 Aug 2005 13:06 GMT
Hi Olaf,

Use the static Control.ModifierKeys and Control.MouseButtons to check the status outside an event.

> 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?
[quoted text clipped - 4 lines]
> 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.

Signature

Happy coding!
Morten Wennevik [C# MVP]

Olaf Baeyens - 16 Aug 2005 13:40 GMT
> 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);
}
Morten Wennevik - 16 Aug 2005 17:33 GMT
Indeed

>> Use the static Control.ModifierKeys and Control.MouseButtons to check the
> status outside an event.
[quoted text clipped - 6 lines]
>     OnRotate(this,RotationEnum.RotateLeft);
> }

Signature

Happy coding!
Morten Wennevik [C# MVP]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.