嵌套上下文菜单
我正在尝试向 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论