WPF KeyUp for enter key in main window after messagebox 使用keyup事件获取键盘"回车"操作,判断并弹出消息框,回车关闭消息框,它再次弹出

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/4c404667-e766-4e5c-9116-a78febbc29d8

 

This is correct behaviour. Buttons respond to the enter key being pressed, not released, so the message box is dismissed as soon as the key is pressed and its parent form activated again. So, the parent form is activated by the time the key is release and it gets the key up message.

The incorrect behaviour in this case is your application showing a message box on a key up. It should either show it on key down, or wait for a full key down then key up cycle to display it.

 

解决方法,使用keydown方法替代,或者使用一组完整的keydown和keyup事件处理

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值