zoukankan      html  css  js  c++  java
  • 动态添加 items to PopupMenu

    引用自http://stackoverflow.com/questions/10175140/adding-items-to-popupmenu

    DevExpress.XtraBars.BarManager barManager1;
                DevExpress.XtraBars.PopupMenu buttonContextMenu;
    
                barManager1 = new DevExpress.XtraBars.BarManager();
                /// Gets or sets the container for bar controls that are managed by the current BarManager.
                barManager1.Form = this;
                buttonContextMenu = new DevExpress.XtraBars.PopupMenu(barManager1);
                buttonContextMenu.Name = "subViewContextMenu";
    
                for (int i = 0; i < 10; i++)
                {
                    DevExpress.XtraBars.BarButtonItem btnitem = new DevExpress.XtraBars.BarButtonItem();
                    btnitem.Caption = "未来" + i.ToString();
                    btnitem.Id = i;
                    btnitem.Name = "barButtonItem1" + i;
                    btnitem.ItemClick += btnitem_ItemClick;
    
                    //add items to barmanager
                    barManager1.Items.Add(btnitem);
                    //create links between bar items and popup
                    buttonContextMenu.ItemLinks.Add(barManager1.Items["barButtonItem1" + i]);
                }
    
                //finally set the context menu to the control or use the showpopup method on right click of control
                barManager1.SetPopupContextMenu(btnshowPop, buttonContextMenu);
  • 相关阅读:
    [go]go addressable 详解
    [go]灵活的处理json与go结构体
    [django]django内置的用户模型
    [go]文件读写&io操作
    *2.3.2_加入env
    UVM_INFO
    uvm_config_db在UVM验证环境中的应用
    *2.2.4 加入virtual interface
    *2.2.3 加入objection机制
    2.2.2 加入factory机制
  • 原文地址:https://www.cnblogs.com/shangshen/p/6433099.html
Copyright © 2011-2022 走看看