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