引用自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 = ; i < ; 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);

最新文章

  1. Sql Server系列:SQL语句查询数据库中表、视图、存储过程等组成
  2. 前端神器avalonJS入门(三)
  3. Java基础(一) ---- 封装(Encapsulation)
  4. 《深入.NET平台和C#编程》内部测试题
  5. 使用Topshelf 开发windows服务
  6. shareSDK
  7. 使用NetBeans搭建基于Spring框架的Web应用
  8. DNS劫持 DNS污染
  9. asp.net生成PDF文件 (1)
  10. DEDECMS采集规则,过滤,替换文章内的部分内容
  11. 【 D3.js 入门系列 — 3 】 做一个简单的图表!
  12. remove()和直接使用system的一个差别
  13. PHP学习过程_Symfony_(4)_命令创建实体_以及实体关系
  14. java存放数据的5个地方
  15. 软考之路--J2SE,从HelloWorld到传世代码
  16. linux tomcat单机部署多应用
  17. 使用Pretues仿真Arduino驱动步进电机
  18. js获取当前url中参数
  19. tar压缩解压文件
  20. 获取Android设备WIFI的MAC地址 “MAC地址”

热门文章

  1. django 使用form组件提交数据之form表单提交
  2. UML中的组合、聚合、关联、继承、实现、依赖
  3. 2-6-搭建FTP服务器实现文件共享
  4. http协议code码
  5. ubuntu中python2与python3的默认启动切换
  6. linux-Centos7安装php
  7. 08day03
  8. iptables详解(9):iptables的黑白名单机制
  9. poj21516
  10. bzoj1704