PDA

Click to See Complete Forum and Search --> : Keyboard Testing


wossname
Aug 30th, 2005, 08:37 AM
Add the class to your project, create a button on your form and bung this code in... Run the program hold down the LEFT control key and click the button :D

private void button1_Click(object sender, System.EventArgs e)
{
if(KeyTester.KeyIsDownNow(KeyTester.Key.LCONTROL))
MessageBox.Show("Left Control is pressed!");
}

Check out the KeyTester.Key enumeration to see all the available testable keys.

There are two other methods in this class for testing if a key is not pressed or if a key is toggled.

*Updated Again*, is now game quality :D

NoteMe
Sep 5th, 2005, 12:57 PM
And change it to this will maybe make it compile too...;)



private void button1_Click(object sender, System.EventArgs e)
{
if(KeyTester.KeyIsDownNow(KeyTester.Key.LCONTROL))
MessageBox.Show("Left Control is pressed!");
}