• Adding Commands to the UICommandBar [Janus UI and Ribbon Controls v3.5 for .NET]

    The following code shows how to add a UICommand into a command bar at run time.



    In VB:



    Dim CommandManager As UICommandManager = New UICommandManager()

    'Assign the control in which the rebar containing the command bars will be placed

    CommandManager.ContainerControl = Me



    Dim CommandBar As Janus.Windows.UI.CommandBars.UICommandBar = New Janus.Windows.UI.CommandBars.UICommandBar("Menu")

    'Assign the UICommandManager that will hold the structure of the command bar.

    CommandBar.CommandManager = CommandManager

    'Specify that the command bar should behave and look as a Menu

    CommandBar.CommandBarType = Janus.Windows.UI.CommandBars.CommandBarType.Menu



    'Create the file command and add it to the Commands collection of the UICommandManager

    Dim baseCommand As UICommand = New UICommand("File", "&File")

    CommandManager.Commands.Add(baseCommand)



    'Create the command that will be placed on the command bar based on the file command

    Dim toolBarCommand As UICommand = New UICommand(baseCommand)

    CommandBar.Commands.Add(toolBarCommand)





    In C#



    Janus.Windows.UI.CommandBars.UICommandManager commandManager = new UICommandManager();

    //Assign the control in which the rebar containing the command bars will be placed

    commandManager.ContainerControl = this;



    UICommandBar commandBar = new Janus.Windows.UI.CommandBars.UICommandBar("Menu");

    //Assign the UICommandManager that will hold the structure of the command bar.

    commandBar.CommandManager = commandManager;

    //Specify that the command bar should behave and look as a Menu

    commandBar.CommandBarType = Janus.Windows.UI.CommandBars.CommandBarType.Menu;



    //Create the file command and add it to the Commands collection of the UICommandManager

    UICommand baseCommand = new UICommand("File", "&File");

    commandManager.Commands.Add(baseCommand);



    //Create the command that will be placed on the command bar based on the file command

    UICommand toolBarCommand = new UICommand(baseCommand);

    commandBar.Commands.Add(toolBarCommand);

    Source Of Information : Janus v3.5 Help Files for VS 2008


1 comments:

  1. Anonymous says:

    http://www.kettic.com/winforms_ui/csharp_guide/commandbar_floating_strips.shtml

Leave a Reply