收集了vs.net的IDE中的ComandBars的名称
为vs.net写addin时,添加菜单的代码一般如下
//添加到工具栏
CommandBar commandBar = (CommandBar)commandBars["Tools"];
CommandBarControl commandBarControl = command.AddControl(commandBar, 1);
那么这个"commandBars["Tools"]"中的除了Tools还有哪些呢?下载以下文件就清楚了,当然这是我IDE的环境,可能与大家有一些差异。
下载CommandBars列表,
到了VS2005重新整理了一份
下载带中文提示的CommandBars列表
//AllCommandBar
Microsoft.VisualStudio.CommandBars.CommandBars bars = (Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars;
//项目的右键快捷菜单
Microsoft.VisualStudio.CommandBars.CommandBar menuBarProjectBar = bars["Project"];
//准备命令:
Command command = commands.AddNamedCommand2(_addInInstance, "NHFrogWizard", "NHFrogWizard", "Executes the command for NHFrogWizard", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
//加入到项目右键的快捷菜单
if ((command != null) && (menuBarProjectBar != null))
command.AddControl(menuBarProjectBar, 1);
Microsoft.VisualStudio.CommandBars.CommandBars bars = (Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars;
//项目的右键快捷菜单
Microsoft.VisualStudio.CommandBars.CommandBar menuBarProjectBar = bars["Project"];
//准备命令:
Command command = commands.AddNamedCommand2(_addInInstance, "NHFrogWizard", "NHFrogWizard", "Executes the command for NHFrogWizard", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
//加入到项目右键的快捷菜单
if ((command != null) && (menuBarProjectBar != null))
command.AddControl(menuBarProjectBar, 1);