Menu work only when Visio start...

F

Ferro Francesco

Hello,

I have created a menu for Visio (inspired by the visio saple code)

applicationCommandBars = (Microsoft.Office.Core.CommandBars)
theApplication.CommandBars;
menuBar = applicationCommandBars.ActiveMenuBar;
menuPopup = (Microsoft.Office.Core.CommandBarPopup)
menuBar.Controls.Add(

Microsoft.Office.Core.MsoControlType.msoControlPopup,
1, "", 10, true);

menuPopup.Caption = "Title menu";

menuItemStop = (Microsoft.Office.Core.CommandBarButton)
menuPopup.Controls.Add(

Microsoft.Office.Core.MsoControlType.msoControlButton,
1, "", 1, true);

menuItemStop.Caption = "Stop menu";

menuItemStop.Style =
Microsoft.Office.Core.MsoButtonStyle.msoButtonCaption;
menuItemStop.Visible = true;


In the visio sample exemple there just the Menu creation but not the
click event.. So i have added this

menuItemStop.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler
(eventHandler.CommandBarButtonClickStop);

Where eventHandler is my menuEventHandler...


So this code Work When i open Visio, and i click on my Menu Title Menu-
StopMenu I can breakpoint on the methode CommandBarButtonClickStop..

But if I open Visio, and then i open a new document.. the Menu doesn't
work anymore !? I have no event when i click on my Menu.


Where is the problem?

Thank's
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top