vb.net 和 ContextMenuStrip?
我正在使用 winforms 和 vb.net。 当我右键单击文本框时,我会看到复制/粘贴等弹出菜单。这没关系。但是,如何向此菜单添加某些内容,以及当单击我添加到其中的项目时,我将在哪里/如何拦截该事件?
I'm using winforms and vb.net.
When I right click on a textbox I get the copy/paste/etc popup menu. This is ok. But How can I add something to this menu, and where/how would I intercept the event when one would click on the Item I add to it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此上下文菜单内置于 Windows 中,没有记录的方法可以更改它。也不存在任何可以诱骗您破解菜单的消息。更换它当然是一个选择,请检查我的答案 此线程获取示例代码。
请小心这一点,在不同的 Windows 版本中,内容会添加到此菜单中。就像Win7中的“插入Unicode字符”一样。如果您的产品可能在东亚国家/地区运行,您肯定希望避免这种情况。
This context menu is baked into Windows, there is no documented way to alter it. Nor is there a message that you could trap to hack the menu. Replacing it is certainly an option, check my answer in this thread for sample code.
Be careful with this, stuff gets added to this menu in different Windows versions. Like "Insert Unicode character" in Win7. You definitely want to avoid this if it is likely that your product will run in an Eastern Asian country.
如果您不想使用默认菜单,则必须添加自己的菜单。
您必须用自己的代码替换现有的默认函数。
You'll have to add your own menu if you don't want to use the default.
You'll have to replace the existing default functions with your own code.