• Creating and displaying a RibbonContextMenu [Janus UI and Ribbon Controls v3.5 for .NET]

    Create and display a context menu in code.



    In VB:



    Dim ctMenu As RibbonContextMenu = New RibbonContextMenu()

    'Create the commands that will be added to the context menu

    Dim cutCommand As DropDownCommand = New DropDownCommand("Cut", "Cu&t")

    Dim copyCommand As DropDownCommand = New DropDownCommand("Copy", "Cop&y")

    Dim pasteCommand As DropDownCommand = New DropDownCommand("Paste", "&Paste")



    'Add the commands to the Commands collection of the context menu

    ctMenu.Commands.Add(cutCommand)

    ctMenu.Commands.Add(copyCommand)

    ctMenu.Commands.Add(pasteCommand)



    'Call the Show method to display the context menu.

    ctMenu.Show()



    In C#:



    RibbonContextMenu ctMenu = new RibbonContextMenu();

    //Create the commands that will be added to the context menu

    DropDownCommand cutCommand = new DropDownCommand("Cut", "Cu&t");

    DropDownCommand copyCommand = new DropDownCommand("Copy", "Cop&y");

    DropDownCommand pasteCommand = new DropDownCommand("Paste", "&Paste");

    //Add the commands to the Commands collection of the context menu

    ctMenu.Commands.Add(cutCommand);

    ctMenu.Commands.Add(copyCommand);

    ctMenu.Commands.Add(pasteCommand);



    //Call the Show method to display the context menu.

    ctMenu.Show();
    Source Of Information : Janus v3.5 Help Files for VS 2008


0 comments:

Leave a Reply