public bool IsSpecialKey(Keys key)
{
// All keys except A-Z, 0-9 and `-\[];',./= (and space) are special keys.
// With shift pressed this also results in this keys:
// ~_|{}:"<>? !@#$%^&*().
int keyNum = (int)key;
if ((keyNum >= (int)Keys.A && keyNum <= (int)Keys.Z) ||
(keyNum >= (int)Keys.D0 && keyNum <= (int)Keys.D9) ||
key == Keys.Space || // well, space ^^
key == Keys.OemTilde || // `~
key == Keys.OemMinus || // -_
key == Keys.OemPipe || // \|
key == Keys.OemOpenBrackets || // [{
key == Keys.OemCloseBrackets || // ]}
key == Keys.OemQuotes || // '"
key == Keys.OemQuestion || // /?
key == Keys.OemPlus) // =+
{
return false;
}
return true;
}
I have experience working with C++ and DirectX. I prefer working with C# and WPF. In my spare time I work with HTML, JS, CSS.
Showing posts with label Special Key. Show all posts
Showing posts with label Special Key. Show all posts
Thursday, May 13, 2010
XNA bool IsSpecialKey(Keys key)
Subscribe to:
Posts (Atom)