发现一个规律,不会的控件先拖到界面上,右上角需要add 的就对应add一个。然后就是找属性和集合手动添加几个。
然后把XXXForm.Designer.cs 里面的代码提取到逻辑代码中,就把常量换成变量就好了。
以galleryControl 为例
//DevExpress.XtraBars.Ribbon.GalleryItem item = new DevExpress.XtraBars.Ribbon.GalleryItem(global::WFInfoSetControlModule.Properties.Resources.u1136, "111asda", "dsafasdfsad");
//item.ImageIndex = 0; item.HoverImageIndex = 0;
//this.galleryControl1.Gallery.Groups[0].Items.Add(item);
//DevExpress.XtraBars.Ribbon.GalleryItem itema = new DevExpress.XtraBars.Ribbon.GalleryItem(global::WFInfoSetControlModule.Properties.Resources.u1136, "111sfsafasda", "dsafassadfsadfsad");
//itema.ImageIndex = 1; itema.HoverImageIndex = 1;
//this.galleryControl1.Gallery.Groups[0].Items.Add(itema);
//DevExpress.XtraBars.Ribbon.GalleryItem itemaa = new DevExpress.XtraBars.Ribbon.GalleryItem(global::WFInfoSetControlModule.Properties.Resources.u1136, "111sadfsadfasda", "dsafasdfsad");
//itemaa.ImageIndex = 2; itemaa.HoverImageIndex = 2;
//this.galleryControl1.Gallery.Groups[0].Items.Add(itemaa);
DevExpress.XtraBars.Ribbon.GalleryItemGroup galleryItemGroup1 = new DevExpress.XtraBars.Ribbon.GalleryItemGroup();
DevExpress.XtraBars.Ribbon.GalleryItem galleryItem1 = new DevExpress.XtraBars.Ribbon.GalleryItem();
DevExpress.XtraBars.Ribbon.GalleryItem galleryItem2 = new DevExpress.XtraBars.Ribbon.GalleryItem();
galleryItem1.Caption = "Item1";
galleryItem1.Image = global::WFInfoSetControlModule.Properties.Resources.u1138;
galleryItem2.Caption = "Item2";
galleryItem2.Image = global::WFInfoSetControlModule.Properties.Resources.u1136;
galleryItemGroup1.Items.AddRange(new DevExpress.XtraBars.Ribbon.GalleryItem[]
{
galleryItem1,
galleryItem2});
galleryItemGroup1.Caption = "Group1";
this.galleryControl1.Gallery.Groups.AddRange(new DevExpress.XtraBars.Ribbon.GalleryItemGroup[] {
galleryItemGroup1});
上面注释的是自己猜的。始终搞不定。最后用了上面的方法。对您有用的点击下面该点的给个赞吧。