Nevron Forum

disable toolbars from NDiagramCommandBarsManager

https://www.nevron.com/Forum/Topic9225.aspx

By Hans Henrik Friis Pedersen - Thursday, June 18, 2015

Hi,

I would like to disable a number of toolbars in Designmode. If I right click on the NDiagramCommandBarsManager and choose "Show Editor" I can disable the different Toolbars. However, when I'm in Runtime, the disabled toolbars seem to re-appear.

How do I make the different toolbars disappear or ".visual = false;"
How can I in runtime make the different toolbars disappear - I have tried to use

nDiagramCommandBarsManager1.Toolbars.


but I do not know how to locate for instance the "Tools" toolbars and inactive that toolbar...

By Nevron Support - Monday, June 22, 2015

Hi,

The NDiagramCommandBarsManager rebuilds the toolbars it contains in its constructor. That is why when you run the program the command bars will be reset. You can either hide the toolbars after the manager is created, or override the command bars builder.

Take a look at the following example:
Visual Interface Components - Command Bars
By Hans Henrik Friis Pedersen - Monday, June 22, 2015

Hi,

I'm afraid the example you stated is of very little help. However, I worked it out my self.

Use the following code; Make sure that the mentioned code is AFTER initilizeComponent:


InitializeComponent();   
//MessageBox.Show(nDiagramCommandBarsManager1.Toolbars[0].ToString() );   
nDiagramCommandBarsManager1.Toolbars[0].Visible = false;   
nDiagramCommandBarsManager1.Toolbars[3].Visible = false;   
nDiagramCommandBarsManager1.Toolbars[4].Visible = false;   
nDiagramCommandBarsManager1.Toolbars[5].Visible = false;   
nDiagramCommandBarsManager1.Toolbars[6].Visible = false;   
nDiagramCommandBarsManager1.Toolbars[7].Visible = false;