How to customize command bars?


Author
Message
Eric Sweet
Eric Sweet
Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)
Group: Forum Members
Posts: 14, Visits: 1
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
Angel Chorbadzhiev
Angel Chorbadzhiev
Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)
Group: Forum Members
Posts: 139, Visits: 184

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.


Eric Sweet
Eric Sweet
Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)
Group: Forum Members
Posts: 14, Visits: 1
That worked perfectly, thanks!

Eric
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search