标签:
public partial class XtraForm2 : DevExpress.XtraEditors.XtraForm { public XtraForm2() { InitializeComponent(); CreateDropDownControl(); } private void CreateDropDownControl() { DropDownButton btn = new DropDownButton(); btn.Text = "Click here"; btn.DropDownControl = CreateDXPopupMenu(); btn.Location = new Point(100, 200); Controls.Add(btn); } private DXPopupMenu CreateDXPopupMenu() { DXPopupMenu menu = new DXPopupMenu(); menu.Items.Add(new DXMenuItem("Item", OnItemClick)); menu.Items.Add(new DXMenuCheckItem("CheckItem", false, null, OnItemClick)); DXSubMenuItem subMenu = new DXSubMenuItem("SubMenu"); subMenu.Items.Add(new DXMenuItem("SubItem", OnItemClick)); menu.Items.Add(subMenu); return menu; } private void OnItemClick(object sender, EventArgs e) { DXMenuItem item = sender as DXMenuItem; XtraMessageBox.Show(item.Caption); } }
标签:
原文地址:http://blog.csdn.net/zhishiheng/article/details/43275031