工具项与菜单项实现相同的功能(DevExpress)

时间:2022-05-04 08:22:06

1、在工具栏中添加菜单项。如下:在bar1工具栏中添加菜单项this.barButtonMenuItem(包含图标)

this.bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
//new DevExpress.XtraBars.LinkPersistInfo( this.barButtonMenuItem), //显示不出图标
new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barButtonMenuItem, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph)}); //主要是用来显示图标和标题

2、点击工具项时,在代码中实现调用菜单栏(略)