日期:2014-05-18 浏览次数:21101 次
if(poWatchContextMenu == null)
                {
                    _CommandBars commandBars = Application.CommandBars; 
                    CommandBar vsBarProject =  Application.CommandBars["Code Window"];
                    poWatchContextMenu = vsBarProject.Controls.Add(MsoControlType.msoControlButton, 1, "", 1, true);
                    poWatchContextMenu.Caption = "My Watch";
                    poWatchContextMenu.TooltipText = "";
                    CommandBarEvents menuItemHandler = (CommandBarEvents)Application.DTE.Events.get_CommandBarEvents(poWatchContextMenu);
                    menuItemHandler.Click += new _dispCommandBarControlEvents_ClickEventHandler(Watch_Click); 
                
                }
------解决方案--------------------
路过,,,学习