KeyEventArgs.Handled VS KeyEventArgs.Su pressKey preSSVS、Handled、KeyEventArgs、preSS

2023-09-03 00:34:36 作者:柔情 只为nl懂

什么是两者的区别:

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.