开发者

A question about "KeyDown"

开发者 https://www.devze.com 2023-03-10 18:34 出处:网络
I am using Visual Studio andI am w开发者_运维百科riting Visual Basic How do I write \"If button ispressed for one second\" ?This is going to require a timer.

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

精彩评论

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