KeyEventArgs.Handled VS KeyEventArgs.Su pressKey preSS [英] KeyEventArgs.Handled vs KeyEventArgs.SupressKeyPress

查看:157
本文介绍了KeyEventArgs.Handled VS KeyEventArgs.Su pressKey preSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是两者的区别:

e.Handled = true

e.SuppressKeyPress = true

我读过燮pressKey preSS电话e.Handled,但其他功能?

I've read that SuppressKeyPress calls e.Handled but else does it do?

推荐答案

根据此博客:的新键盘的API:KeyEventArgs.Sup pressKey preSS

问题是,处理的不采取未决的 WM_CHAR   消息已建成的消息队列 - 如此设置进行处理=   真不prevent密钥preSS的发生。

The problem is that "Handled" doesn't take care of pending WM_CHAR messages already built up in the message queue - so setting Handled = true does not prevent a KeyPress from occurring.

为了不打破任何人谁目前已经得到了e.Handled =   如此,我们需要添加一个名为燮pressKeyChar新的属性。如果我们   去的其他方式,如果处理一个的keydown突然开始   实际工作中,我们可能会破坏人谁不小心有这个设置为   真的。

In order not to break anyone who has currently got e.Handled = true, we needed to add a new property called SuppressKeyChar. If we went the other way, if "handling" a keydown suddenly started to actually work, we might break folks who accidentally had this set to true.

这篇关于KeyEventArgs.Handled VS KeyEventArgs.Su pressKey preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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