How do you deactivate a key in a complete Form?

1

How can I disable the program's TAB or ALT key? Example: Clicking TAB does not make any changes.

Is it possible in KeyDown ?

    
asked by anonymous 31.08.2015 / 01:36

1 answer

2

No KeyDown put something like this:

if (e.KeyCode == Keys.Tab || e.Alt) {
    e.SuppressKeyPress = true;
}

Obviously you can put the keys you want. Note the difference between a "normal" key and a modifier. The SuppressKeyPress is the secret to swallowing the key without doing anything.

    
31.08.2015 / 02:24