如何防止 Texter/PhraseExpress 在 VB.NET 中导致 KeyUp 事件失火?
我有一个 VB.NET 应用程序。当安装并启用Texter或PhraseExpress时,程序表现不佳。调试显示,有时我可以在字段中按 Enter 键,但不会触发任何事件(即事件处理程序中没有断点被击中),然后我再次按 Enter 键,它们将被触发两次。 (基本上,如果我一直按 Enter 键,就会发生这些循环 - 一次什么也不会发生,下一次我收到两个事件,下一次按键不执行任何操作,下一次触发两个事件,等等)
由于 Enter 在某些地方使用来触发搜索,或者使用数字键盘在字段之间移动以快速输入数据,这会有效地破坏这些位置的程序。
该问题具有高度可重复性 - 禁用 Texter 或 PhraseExpress 会导致程序完全正常运行。再次启用它们会导致其损坏。
请注意,在两个文本扩展程序中,我都没有为 Enter 键分配任何事件。事实上,对于 Texter(尚未使用 PE 进行此特定测试),即使根本没有定义任何替换,仅基于 Texter 是启用还是禁用,也会发生这种情况。
I have a VB.NET application. When Texter or PhraseExpress is installed and enabled, the program behaves poorly. Debugging has revealed that at times I can press Enter in a field and no event will be fired (i.e. no breakpoints in the event handlers get hit), then I press it again, and they will be fired twice. (Basically these cycle if I keep pressing enter - one time nothing will happen, the next I get two events, the next keypress does nothing, the next triggers two events, etc.)
Since Enter is used in certain places to trigger searches, or to move between fields for fast data entry using the numeric keypad, this effectively breaks the program in these spots.
The problem is highly repeatable - disabling Texter or PhraseExpress causes the program behaves perfectly normally. Enabling them again causes it to break.
Note that in both text expansion programs, I have assigned NO events to the Enter key. In fact, with Texter (haven't done this particular test with PE yet), it happens even if NO replacements have been defined at all, simply based on whether Texter is enable or disabled.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 PhraseExpress 中,如果您遇到这些按键问题,请禁用专家选项“通过 PhraseExpress 路由 TAB 和 ENTER”。
屏幕截图:
另请注意,同时使用多个文本扩展器可能会产生干扰,正如您所经历的那样。不幸的是,我们的供应商没有办法绕过这个限制。
迈克尔·施密特
短语表达团队
In PhraseExpress, please disable the expert option "Route TAB and ENTER through PhraseExpress" if you experience problems those keys.
Screenshot:
Please also note that using multipe Text Expander simultaneously may introduce interferences as you experienced. Unfortunately, there is no way to get around this limitation for us vendors.
Michael Schmidt
PhraseExpress Team
尝试通过覆盖 ProcessDialogKey 来监听事件
http://msdn.microsoft.com/en -us/library/system.windows.forms.control.processdialogkey.aspx
而不是直接附加到控件的事件。
Try listening to events by overriding ProcessDialogKey
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.processdialogkey.aspx
instead of attaching to the control's event directly.