Nhân Nguyễn Nhân Nguyễn - 3 months ago 13
C# Question

Press key and hold event for button in Winform

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

Answer

It's KeyDown, KeyPress, and KeyUp event you should use.

Refer to this link.

http://csharp.net-informations.com/gui/key-press-cs.htm