PopupMenu控件的使用

齐健柏
2023-12-01

1、用PopupMenu控件能进行右键菜单的实现,它的实现还需要绑定到barManager控件上,在barManager的Customize中添加右键所需要显示的功能。

2、PopupMenu属性栏中绑定Manager为barManager;

3、窗体加载事件中创建 this.popupMenu1.AddItems(new BarItem[] { barButtonItem1, barButtonItem2 });

4、显示右键

if (e.Button == MouseButtons.Right)
{
this.popupMenu1.ShowPopup(barManager1,new Point(this.Location.X,this.Location.Y));
}

 类似资料: