Nevron Forum

How to customize command bars?

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

By Eric Sweet - Wednesday, June 9, 2010

Hi,

I'm trying to customize the toolbar by hiding some of the menu options and associated buttons, but can't figure out quite how to do it. I've tried the code sample in the KB to remove a command, and that works, but it leaves the menu item and button in place, just without functionality.

Any tips on how to accomplish this?

Thanks,
Eric
By Angel Chorbadzhiev - Thursday, June 10, 2010

Hi Eric,

You can set Visible property of the command properties to false. This way the command still will be in the toolbar Commands collection, but it will be invisible.

For example if you want to hide File -> New menu item and New command in the toolbars you can do the following:

NMenuBar mainMenu = (NMenuBar)nDiagramCommandBarsManager1.Toolbars["Main Menu"];

mainMenu.Commands[1].Commands[0].Properties.Visible = false;

NDockingToolbar toolbar = nDiagramCommandBarsManager1.Toolbars["Standard"];

NCommand c = toolbar.Commands[1];

c.Properties.Visible = false;

nDiagramCommandBarsManager1.Refresh();

I hope this helps.

Regards,

Angel Chorbadzhiev.

By Eric Sweet - Thursday, June 10, 2010

That worked perfectly, thanks!

Eric