I am working on visio add-ins using c#,VS 2012 and visio 2007.I am able to create Menu and Menu Item progmatically but when clicking on Menu item i.e. ChangeColor menu event is not firing.Any help will be appreciated.
Menu/Menu Item code :
Visio.Application visioApplication;
object visioObject = Marshal.GetActiveObject("Visio.Application");
//converting object type to Visio type
visioApplication = visioObject as Visio.Application;
applicationCommandBars =
(CommandBars)visioApplication.CommandBars;
menuBar = applicationCommandBars.ActiveMenuBar;
// Add a pop-up menu to the end of the active menu bar.
menuPopup =
(CommandBarPopup)menuBar.Controls.Add(MsoControlType.msoControlPopup, 1, "", 10, true);
menuPopup.Caption = "&MyMenu"; ;
menuItem = (CommandBarButton)menuPopup.Controls.Add(MsoControlType.msoControlButton, 1, "", 1, true);
menuItem.Caption = "&ChangeColor"; ;
menuItem.Style = MsoButtonStyle.msoButtonCaption;
menuItem.Visible = true;
menuItem.Click += menuItem_Click;