在 Visual Studio 中创建新的顶级菜单
我们有一个 VS 的插件,目前是从工具菜单启动的,该插件由一个 UI 组成,为用户提供了一些选项按钮,我现在想将其转换为提供相同功能的顶级菜单。
我已阅读此教程,它帮助我添加了一个新的顶部-级别菜单,但无法真正理解所有步骤背后的逻辑。该指南并没有真正清楚每个步骤创建的内容或如何更改输出。
这些步骤创建的是一个新的顶级菜单,其下方有一个项目。我试图在菜单中创建一些层次结构(即顶级 -> 子类别 -> 命令),但对所有组/菜单/ID 结构有点迷失。 这些文件的结构有明确的解释吗?文档还是教程?如果有人有该主题的经验并且可以帮助解决问题,我将非常感激......
We have an add in for VS that currently is launched from the tools menu, the add-in consists of a a UI offering the user a few option buttons, which I now want to convert to a top-level menu that would offer the same functionality.
I've read this tutorial, which helped me add a new top-level menu, but couldn't really understand the logic behind all the steps. The guide doesn't really clear what each of the steps create or how can your change the output.
What the steps create is a new top-level menu with a single item underneath it. I'm trying to create some hierarchy in my menu (i.e. Top Level -> Sub category -> Commands) but got abit lost with all the groups/menus/IDs structure.
Is there any clear explanation for the structure of these files? A documentation or a tutorial? If anyone had experience in the subject and could help clear things up I would much appreciate it...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我还没有尝试过执行分层菜单项,但我在使用 Visual SDK .vcst 文件时遇到了类似的问题。这是一种痛苦。您可以做几件事。
I haven't tried doing hierarchical menu items, but I have had similar problems with the Visual SDK .vcst file. It is a pain. A couple of things you can do.
我认为现在所说的“插件”是指 VS 包(使用 VS SDK)的扩展,因为“插件”是 VS 2013 及更低版本的较旧形式的扩展。 (如果您确实指的是“加载项”,请参阅我的示例 HOWTO:添加按钮,从加载项到 Visual Studio .NET 的命令栏和工具栏)
包使用 .vsct 文件。要回答您的问题,请在此处查看我的示例的 .vsct 文件:
(要学习,请参阅其他内容的上下文菜单、工具栏等)。在 .vcst 文件中,他们使用“CommandPlacements”将项目的定义与其“位置”分开,并使用注释来解释 3 种项目之间的关系:
记住规则:
I assume that nowadays by "add-in" you mean an extension that is a VS package (using the VS SDK) because an "add-in" was an older form of extension for VS 2013 and lower. (If you really mean an "add-in" then see my sample HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in)
Packages use .vsct files. To answer your question, see the .vsct files of my samples here:
(and to learn see also the other ones for context menus, toolbars, etc.). In the .vcst file they use "CommandPlacements" to separate the definition of an item from its "placement", and comments to explain the relationship between the 3 kinds of items:
Remember the rules:
代码示例
这为您提供了以下顶级菜单:
这是有关该主题的完整章节。这几乎解释了(分层)菜单上需要了解的所有内容。
http://dotneteers.net/blogs/divedeeper/archive/2010/05/23/vs-2010-package-development-chapter-2-commands-menus-and-toolbars.aspx
Code example
This provides you with the following top-level menu:
Here's a full chapter on the topic. This pretty much explains everything there is to know on (hierarchical) menu's.
http://dotneteers.net/blogs/divedeeper/archive/2010/05/23/vs-2010-package-development-chapter-2-commands-menus-and-toolbars.aspx