Visual Studio 中 KeyDown 事件、KeyPress 事件和 KeyUp 事件的区别 [英] Difference between the KeyDown Event, KeyPress Event and KeyUp Event in Visual Studio

查看:38
本文介绍了Visual Studio 中 KeyDown 事件、KeyPress 事件和 KeyUp 事件的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我 KeyDown 事件、KeyPress 事件和 KeyUp 事件之间的区别?我检查了 msdn 站点,它没有解释太多.

Can anyone tell me the difference between the KeyDown event, the KeyPress event and the KeyUp event? I checked the msdn site and it does not explain it much.

谁能用简单的逻辑告诉我每个事件何时发生?我觉得当按下一个键时会发生上述所有事件.那么它们之间的确切区别是什么.

Can anyone tell me in simple logical sense when each of the event occurs? I feel that all the above event occurs when a key is pressed. So what is the exact difference between them.

推荐答案

  • KeyDown:当人按下一个键时发生(当键盘第一次检测到一个键上的手指时,当按下该键时会发生这种情况).

    • KeyDown: happens when the person presses a key (when the keyboard first detects a finger on a key, this happens when the key is pressed down).

      KeyPress:当一个键被按下然后松开时发生.

      KeyPress: happens when a key is pressed and then released.

      KeyUp:释放键时发生

      KeyUp: happens when the key is released

      您是对的,所有这些事件都发生在按我上面描述的顺序按下然后释放某个键时.

      You are right that all of these events occur when a key is pressed and then released, in the order I described above.

      这篇关于Visual Studio 中 KeyDown 事件、KeyPress 事件和 KeyUp 事件的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆