Reputation: 107
I'm trying to make a button change its fore color when we press a key. Like button's name is "A" and we press A it changes the fore color into red, then we release the key it turns back to its default color. But I can't find any such event. Thank you! :D
Upvotes: 3
Views: 3275
Reputation: 2650
If you want to capture a key typed anywhere on a form, you can use Keydown
, KeyPress
and KeyUp
like ydoow said, but you will also have to set the form's KeyPreview
property to true to make sure your events are raised even if a key is typed while in a specific control.
Upvotes: 1
Reputation: 2996
It's KeyDown
, KeyPress
, and KeyUp
event you should use.
Refer to this link.
http://csharp.net-informations.com/gui/key-press-cs.htm
Upvotes: 4