强制不处理事件
C# WinApps:主窗体有一个与 CTRL-V 绑定的键...因此,当我按 CTRL-V 时,主应用程序中的任何位置都会运行一些东西..好...但也有一些 MDI 应用程序在该主窗体中打开应用程序...其中一个有一个测试框...啊!现在 CTRL-V 对于文本框也有“粘贴”的含义...所以我将 PreViewKeyDown 添加到文本框并处理它,所以现在它正在粘贴,但它也在执行我定义的主要 CTRL-V 键绑定对于整个应用程序......但我不希望这种情况发生......我能做什么? (我无法更改主应用程序的键绑定。我必须保留它。)
C# WinApps: the main form has a key binding to CTRL-V ...so anywhere in the main app when I press CTRL-V something runs..good ... but also there are some MDI apps that are opening inside this main app ... in one of those there is a test box...ah! now CTRL-V also has a meanining for text box which is "Paste" ... so I added PreViewKeyDown to textbox and handled it, so now it is pasting BUT it is ALSO doing the main CTRL-V key binding that I had defined for the whole app ... but I do no want this to happen.... what can I do? ( I cannot change the key binding od the main app. I must keep it.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要注册 Control.KeyDown 事件并将其标记为已处理,以防止该事件进一步传播。
You need to register for the Control.KeyDown event and mark it as handled to prevent further propagation of the event.