开发者

How to prevent a key from being held down on a button? C#

开发者 https://www.devze.com 2023-01-12 09:00 出处:网络
I am writing a game where you need to click a button as m开发者_StackOverflow中文版any times as you can in 10 seconds. The problem is that it is possible to hold the Enter key down to superspeed the c

I am writing a game where you need to click a button as m开发者_StackOverflow中文版any times as you can in 10 seconds. The problem is that it is possible to hold the Enter key down to superspeed the counter.

How can I prevent this? I tried KeyDown Events but it doesn't seem to fire when the key is held down.

Thanks.


Use the MouseClick event as that only captures clicks by the mouse.


try handling KeyPress instead of KeyDown.

0

精彩评论

暂无评论...
验证码 换一张
取 消