英文:
.NET WinForms KeyEventArgs.SuppressKeyPress: effect of setting it to True in the KeyUp event
问题
KeyEventArgs
类在 WinForms 中实现了布尔型的 SuppressKeyPress
属性。KeyEventArgs
为 KeyDown
和 KeyUp
事件提供数据。在 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论