发现一个规律,不会的控件先拖到界面上,右上角需要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});

上面注释的是自己猜的。始终搞不定。最后用了上面的方法。对您有用的点击下面该点的给个赞吧。

相关文章:

  • 2021-06-19
  • 2021-12-07
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-08-22
猜你喜欢
  • 2022-12-23
  • 2021-05-16
  • 2021-09-29
  • 2021-09-14
  • 2021-09-30
  • 2021-08-31
  • 2021-06-26
相关资源
相似解决方案