嵌套上下文菜单

发布于 2025-01-04 06:42:10 字数 328 浏览 5 评论 0原文

我正在尝试向 ToolStripMenuItem 添加右键菜单,但我不确定如何做到这一点。

我继承的应用程序创建的是一个系统托盘应用程序,它根据 xml 文件的输入动态创建并显示带有 ToolStripMenuItems 的 ContextMenuStrip。所以我想做的是向 ContextMenuStrip 中的每个 ToolStripMenuItem 添加右键菜单选项。有没有简单的方法可以做到这一点?我能想到的唯一方法是创建一个表单并将其显示在 ToolStripMenuItem 的右键单击事件上的光标位置,但这意味着我必须自己将所有菜单突出显示/选择功能写入表单中或者在表单中添加一些笨重的按钮来完成我想要的操作。

I'm trying to add a right click menu to a ToolStripMenuItem but I'm unsure how to do that.

The application I've inherited creates is a system tray application that creates and displays a ContextMenuStrip with ToolStripMenuItems in it on the fly based on input from an xml file. So what I'd like to do is add a right-click menu option to each ToolStripMenuItem in the ContextMenuStrip. Is there an easy way to do this? The only way I can think of is to create a form and display it at the cursor location on a right-click event to the ToolStripMenuItem, but that means i'd have to write all the menu highlighting/selection functionality in to the form myself or add some clunky buttons to the form that do what I want.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文