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.
精彩评论