KeyEventArgs.SuppressKeyPress: 在 KeyUp 事件中将其设置为 True 的效果

huangapple go评论79阅读模式
英文:

.NET WinForms KeyEventArgs.SuppressKeyPress: effect of setting it to True in the KeyUp event

问题

KeyEventArgs 类在 WinForms 中实现了布尔型的 SuppressKeyPress 属性。KeyEventArgsKeyDownKeyUp 事件提供数据。在 KeyDown 事件处理程序中将 SuppressKeyPress 属性设置为 True 可以抑制后续的 KeyPress 事件 - 这个目的很明确。但是在 KeyUp 事件的事件处理程序中将 SuppressKeyPress 设置为 True 会产生什么影响呢?

英文:

The KeyEventArgs class in WinForms implements the Boolean SuppressKeyPress property. KeyEventArgs provides data for the KeyDown and KeyUp events. The SuppressKeyPress property can be set to True in a KeyDown event handler to suppress the subsequent KeyPress event - this purpose is clear. But is there any effect of setting SuppressKeyPress to True in event handlers of the KeyUp event?

答案1

得分: 0

我完全同意所有评论者的观点,即“SuppressKeyPress”在“KeyUp”中是绝对无用的。正如@Jimi解释的那样,这个字段之所以出现在“KeyUp”中,仅因于Control类的特定内部架构。

英文:

I totally agree with all commenters that SuppressKeyPress is absolutely useless in KeyUp. As @Jimi explained, this field appears in KeyUp only because of the specific internal architecture of the Control class.

huangapple
  • 本文由 发表于 2023年2月23日 19:26:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75544186.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定