以编程方式创建菜单DevExpress

时间:2010-11-22 21:58:02

标签: windows devexpress

如何动态创建菜单?

详细说明我想:

  • 创建一个新的功能区页面(选项卡,我认为它称为功能区页面)
  • 接下来为页面创建标题
  • 接下来添加2个功能区组并为其添加标题
  • 接下来,将3个条形按钮项添加到第一个功能区组

如何做到这一点?

1 个答案:

答案 0 :(得分:0)

 Dim menu As New RibbonControl


    Dim aPage As New RibbonPage("Nicks Page")

    'groups
    Dim aGroup1 As New RibbonPageGroup("1st Group")


    'ADD BUTTONS TO RIBBON GROUP HERE
    Dim i As New DevExpress.XtraBars.BarButtonItem()

    i.Caption = "Nicks Button"

    aGroup1.ItemLinks.Add(i)




    Dim i2 As New DevExpress.XtraBars.BarButtonItem()
    i2.Caption = "Nicks Other Button"

    aGroup1.ItemLinks.Add(i2)




    aPage.Groups.Add(aGroup1)

    menu.Pages.Add(aPage)

    Me.Controls.Add(menu)