天天看點

DevExpress Ribbongallerybaritem選擇性皮膚重組

DevExpress Ribbongallerybaritem選擇性皮膚重組

void InitSkinGallery()

 (系統自帶的初始化皮膚方法,隻需複制替換方法即可)      

{         

        SkinHelper skinHelper = new

SkinHelper();            

RibbonControl masterRibbonControl = new RibbonControl();

RibbonGalleryBarItem tempRibbonGalleryItem = new RibbonGalleryBarItem(new

BarManager());            

//  masterRibbonControl.ApplicationButtonDropDownControl =

tempRibbonGalleryItem;

SkinHelper.InitSkinGallery(tempRibbonGalleryItem);   //初始化各種控件皮膚的方法

SkinHelper.InitSkinGallery(ribbonGalleryBarItem1);

//customRibbonGrallery.Gallery.Groups.RemoveAt(1);

//customRibbonGrallery.Gallery.Groups.RemoveAt(2);

GalleryItemGroupCollection Collection = tempRibbonGalleryItem.Gallery.Groups;

//MessageBox.Show(Collection.Capacity.ToString());

            int TempIndex

= 0;

GalleryItemGroup SkinGroup = new GalleryItemGroup();

            foreach

(GalleryItemGroup singleItemGroup in Collection)

            {

TempIndex++;

for (int i = 0; i < singleItemGroup.Items.Count; i++)

{

GalleryItem item = singleItemGroup.Items[i];

// GalleryItem itemx = new GalleryItem();

//  itemx.Caption = "";

if (TempIndex == 1)

if (i == 0 || i == 5)

//textEdit1.Text = textEdit1.Text + "|" + item.Caption;

SkinGroup.Items.Add(item);

}

else if (TempIndex == 2)

if (i == 1 || i == 11 || i == 14)

// textEdit2.Text = textEdit2.Text + "|" + item.Caption;

else if (TempIndex == 3)

if (i == 2 || i == 3 || i == 4)

//textEdit3.Text = textEdit3.Text + "|" + item.Caption;

else

}             }

recombinationSkin.Gallery.Groups.Add(SkinGroup);

DefaultLookAndFeel Custom = new DefaultLookAndFeel();

Custom.LookAndFeel.SetSkinStyle("Office 2010 Blue");

//RibbonGralleryBarItem控件皮膚選擇事件

private void recombinationSkin_GalleryItemClick(object sender,

GalleryItemClickEventArgs e)

            string

SkinValue=e.Item.Caption;

DefaultLookAndFeel Custom = new

DefaultLookAndFeel();

Custom.LookAndFeel.SetSkinStyle(SkinValue);

        }

上一篇: 記憶體
下一篇: 主存