效果图:

由于经常用到该功能,准备一个类:

//传入两个控件

public void DropMenu(ContextMenuStrip contextMenuStrip,Button button)
{
int x = 0;
int y = button.Top;
Point point = new Point(x,y);
contextMenuStrip.Show(button,point);//跟随显示
}

前台:绑定新建的contextMenuStrip1控件以及需要单击显示的按钮

 office1.DropMenu(contextMenuStrip1, this.button13);   

 

扩展:ContextMenuStrip的其它功能可以使用单选、单击同理

 

posted on 2015-09-11 16:38  FEX-x  阅读(207)  评论(0)    收藏  举报