简体   繁体   English

强制不处理事件

[英]forcing to Not to process an event

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! C#WinApps:主窗体具有与CTRL-V的键绑定...因此,当我按CTRL-V时,在主应用程序中的任何地方都可以运行..好...但也有一些MDI应用程序正在该主程序中打开app ...其中一个有一个测试盒......啊! 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? 现在CTRL-V也有一个意思是“粘贴”的文本框...所以我在文本框中添加了PreViewKeyDown并对其进行了处理,所以现在它正在粘贴,但它也在做我定义的主要CTRL-V键绑定整个应用程序...但是我不希望这种情况发生....我该怎么办? ( I cannot change the key binding od the main app. I must keep it.) (我无法更改主应用程序的键绑定。必须保留它。)

您需要注册Control.KeyDown事件并将其标记为已处理,以防止事件进一步传播。

e.Handled = true;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM