假设cmdMyDropdown是commandId你的下拉列表,然后你需要创建一个OleMenuCommand并将其添加到OleMenyCommandService。
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
CommandID commandId = new CommandID(GuidList.guidExtensionCmdSet, (int) PkgCmdIDList.cmdMyDropdown);
OleMenuCommand menuMyDynamicComboCommand = new OleMenuCommand(new EventHandler(OnMenuWorkorderDropdown), commandId);
mcs.AddCommand(menuMyDynamicComboCommand);
在你的情况下,你就必须使用
Marshal.GetNativeVariantForObject(String[] yourValues, OleMenuCmdEventArgs.OutValue);
OutValue是获取传递的下拉参考。
更多此处了解:http://dotneteers.net/blogs/divedeeper/archive/2008/07/14/LearnVSXNowPart25.aspx
来源
2013-01-08 21:25:48
Ben