views:

160

answers:

0

I have a Visio Addin written in C# that add a custom CommandBar to Visio. The MSDN documentation mentions that the Visible property of the CommandBar is False by default.

However, my CommandBar is being displayed by default when my Addin starts (even If I force the visibility to False). What is strange, is that it happens only at startup. When I toggle the visibility after that (for example when creating a new document) the code behave as expected.

Here is the code that is used to create my CommandBar:

CommandBars bars = (CommandBars)visioApplication.CommandBars;
CommandBar bar = bars.Add(Localization.ToolBarName, MsoBarPosition.msoBarTop, Missing.Value, true);

If I inspect the bar variable, I see the the Visible's value is False.

The code is being invoked when the addin starts up from

private void ThisAddIn_Startup(object sender, System.EventArgs e)

However the Command is being displayed Nonetheless. Any ideas or pointers?

Thank in advance!