开发者

A question about "KeyDown"

I am using Visual Studio and I am w开发者_运维百科riting Visual Basic

How do I write "If button is pressed for one second" ?


This is going to require a timer.

  • Set a timer to elapse after 1 second and enable it in keydown.
  • On keyup disable the timer
  • In the timer event put the code you want to happen after one second of keydown (but disable the timer first so it doesn't fire twice).

Note: you'll need to consider what you want to do in the case of multiple keydowns/presses as this makes this scenario harder.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜