private event EventHandle MyEventA;
private event EventHandle MyEventB;
// 构造
public xxx()
{
InitializeComponent();
MyEventA += OnEventA;
MyEventA += OnEventB;
}
// 右键
private void xxx_MouseUp(object sender, MouseEventArg e)
{
if(e.Button == MouseButtons.Right)
{
var menu = new DxPopupMenu();
menu.Items.Add(new DXMenuItem("选项1", MyEventA));
var parentItem = new DxSubMenuItem("父选项");
parentItem.Items.Add(new DXMenuItem("子选项1", MyEventB));
menu.Item.Add(parentItem );
menu.ShowPopup(this, e.Location);
}
}
private void OnEventA(Object sender, EventArg e)
{
// 完成A事件的响应
}
private void OnEventA(Object sender, EventArg e)
{
// 完成B事件的响应
}