如何向 Visual Studio 2012 添加命令? [英] How to add commands to Visual Studio 2012?

查看:43
本文介绍了如何向 Visual Studio 2012 添加命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将自定义命令添加到键盘对话框(工具->选项->键盘)以便通过快捷键触发它们?不幸的是,我在网上找不到任何资源.

How can I add custom commands to the keyboard dialog (Tools->Options->Keyboard) in order to trigger them by shortcuts? Unfortunately, I could not find any resource on the web.

我越过了这个blog post,但略有不同,因为我必须创建一个菜单条目.我只想在键盘对话框中显示命令.就像它与宏一起工作一样.

I crossed this blog post, but it's slightly different, because I'd have to create a menu entry. I only want to show the commands in the keyboard dialog. Just like it worked with macros.

推荐答案

VS 2012 这方面我没查过,不过我觉得和之前的版本一样.

I have not checked VS 2012 in this area, but I think it's the same as for previous version.

所有菜单和命令内容都在名为 [mypackage].vsct 的文件中进行了本地化,该文件是 Visual Studio 命令表.架构在此处描述:VSCT XML 架构参考.当您使用该向导时,它可能会为您创建一个.

All that menu and command stuff is localized in a file called [mypackage].vsct which is the Visual Studio Command Table. The schema is described here: VSCT XML Schema Reference. When you used the wizard it probably created one for you.

正如您在架构中看到的,命令总是以某种方式链接到菜单 (命令元素),但是您可以使用许多标志来调整它:命令标志元素.根据您的操作,我会尝试使用 CommandWellOnly、DefaultInvisible 和 DynamicVisibility.

As you can see in the schema, a Command is always linked somehow to a Menu (Commands Element), but there are a number of flags you can use to tweak this: Command Flag Element. Depending on what you do, I'd try the CommandWellOnly, DefaultInvisible and DynamicVisibility.

无论如何,如果您不希望菜单出现在顶部菜单栏上,也可以更改根

<的 元素vsct 文件中的/code> 元素.

Anyway, if you don't want your menu to appear on the top menu bar, just can also just change the <Parent> element of the root <Menu> element in the vsct file.

这篇关于如何向 Visual Studio 2012 添加命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆