private void SetColorScheme(eSideBarColorScheme scheme) { SideBar sidebar=this.Control as SideBar; if(sidebar!=null) { if(sidebar.Appearance!=eSideBarAppearance.Flat) TypeDescriptor.GetProperties(sidebar)["Appearance"].SetValue(sidebar, eSideBarAppearance.Flat); TypeDescriptor.GetProperties(sidebar)["PredefinedColorScheme"].SetValue(sidebar, scheme); sidebar.ApplyPredefinedColorScheme(scheme); this.RaiseStyleChanged(); } }
public void ApplyPredefinedColorScheme(eSideBarColorScheme scheme) { if(m_ItemContainer==null) return; SideBar.ApplyColorScheme(this.ColorScheme,scheme); foreach(BaseItem item in m_ItemContainer.SubItems) { if(item is SideBarPanelItem) SideBar.ApplyColorScheme((SideBarPanelItem)item,scheme); } this.Refresh(); }
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { eSideBarColorScheme scheme; if(listBox1.SelectedIndex<0) return; string sSel=listBox1.SelectedItem.ToString(); scheme=(eSideBarColorScheme)Enum.Parse(typeof(eSideBarColorScheme),sSel,false); SelectedColorScheme=scheme; sideBar1.PredefinedColorScheme=scheme; }
private static SideBarColors GetFlatColorScheme(eSideBarColorScheme scheme) { Color border=Color.Empty; Color background=Color.Empty; Color sideBack=Color.Empty; Color headerBack=Color.Empty; Color headerText=Color.Empty; Color headerHot=Color.Empty; Color itemHotBack=Color.Empty; Color itemHotBorder=Color.Empty; Color itemPressedBack=Color.Empty; switch(scheme) { case eSideBarColorScheme.Brick: { border=Color.FromArgb(66,0,0); background=Color.White; sideBack=Color.FromArgb(204,102,102); headerBack=Color.FromArgb(227,220,198); headerText=Color.Black; itemHotBack=Color.FromArgb(255,153,153); itemHotBorder=Color.FromArgb(132,0,0); headerHot=Color.FromArgb(245,238,217); break; } case eSideBarColorScheme.Wheat: { border=Color.FromArgb(132,130,0); background=Color.White; sideBack=Color.FromArgb(177,174,0); headerBack=Color.FromArgb(239,240,120); headerText=Color.Black; itemHotBack=Color.FromArgb(244,245,169); itemHotBorder=Color.FromArgb(132,130,0); headerHot=Color.FromArgb(254,255,178); break; } case eSideBarColorScheme.Storm: { border=Color.FromArgb(132,0,132); background=Color.White; sideBack=Color.FromArgb(162,78,162); headerBack=Color.FromArgb(226,189,226); headerText=Color.Black; itemHotBack=Color.FromArgb(226,189,226); itemHotBorder=Color.FromArgb(132,0,132); headerHot=Color.FromArgb(244,223,244); break; } case eSideBarColorScheme.Spruce: { border=Color.FromArgb(51,102,51); background=Color.White; sideBack=Color.FromArgb(90,150,99); headerBack=Color.FromArgb(165,228,165); headerText=Color.Black; itemHotBack=Color.FromArgb(204,255,204); itemHotBorder=Color.FromArgb(51,102,51); headerHot=Color.FromArgb(204,231,204); break; } case eSideBarColorScheme.Slate: { border=Color.FromArgb(34,82,127); background=Color.White; sideBack=Color.FromArgb(123,167,184); headerBack=Color.FromArgb(186,204,216); headerText=Color.Black; itemHotBack=Color.FromArgb(129,191,232); itemHotBorder=Color.FromArgb(34,82,127); headerHot=Color.FromArgb(232,232,232); break; } case eSideBarColorScheme.Rose: { border=Color.FromArgb(102,45,63); background=Color.White; sideBack=Color.FromArgb(182,100,125); headerBack=Color.FromArgb(206,174,181); headerText=Color.Black; itemHotBack=Color.FromArgb(241,163,180); itemHotBorder=Color.FromArgb(102,45,63); headerHot=Color.FromArgb(242,200,209); break; } case eSideBarColorScheme.Fire: { border=Color.FromArgb(92,0,0); background=Color.White; sideBack=Color.FromArgb(175,32,32); headerBack=Color.FromArgb(198,198,198); headerText=Color.Black; itemHotBack=Color.FromArgb(242,84,84); itemHotBorder=Color.FromArgb(92,0,0); headerHot=Color.FromArgb(255,142,142); break; } case eSideBarColorScheme.Pumpkin: { border=Color.FromArgb(123,96,27); background=Color.White; sideBack=Color.FromArgb(214,166,41); headerBack=Color.FromArgb(239,215,156); headerText=Color.Black; itemHotBack=Color.FromArgb(239,191,97); itemHotBorder=Color.FromArgb(123,96,27); headerHot=Color.FromArgb(255,239,198); break; } case eSideBarColorScheme.Plum: { border=Color.FromArgb(74,65,99); background=Color.White; sideBack=Color.FromArgb(119,106,154); headerBack=Color.FromArgb(173,154,148); headerText=Color.Black; itemHotBack=Color.FromArgb(205,188,182); itemHotBorder=Color.FromArgb(74,65,99); headerHot=Color.FromArgb(219,195,188); break; } case eSideBarColorScheme.Marine: { border=Color.FromArgb(0,0,132); background=Color.White; sideBack=Color.FromArgb(83,168,159); headerBack=Color.FromArgb(154,214,207); headerText=Color.Black; itemHotBack=Color.FromArgb(79,198,185); itemHotBorder=Color.FromArgb(0,0,132); headerHot=Color.FromArgb(188,231,226); break; } case eSideBarColorScheme.Sunset: { border=Color.FromArgb(176,87,0); background=Color.White; sideBack=Color.FromArgb(219,155,0); headerBack=Color.FromArgb(255,212,110); headerText=Color.Black; itemHotBack=Color.FromArgb(247,193,77); itemHotBorder=Color.FromArgb(176,87,0); headerHot=Color.FromArgb(253,226,162); break; } } itemPressedBack=ControlPaint.Light(itemHotBack); SideBarColors c=new SideBarColors(); c.Background=background; c.Border=border; c.HeaderBackground=headerBack; c.HeaderSideBackground=sideBack; c.HeaderHotBackground=headerHot; c.HeaderSideHotBackground=headerHot; c.HeaderText=headerText; c.ItemCheckedBorder=border; c.ItemCheckedText=headerText; c.ItemHotText=headerText; c.ItemHotBackground=itemHotBack; c.ItemHotBorder=itemHotBorder; c.ItemPressedText=headerText; c.ItemPressedBackground=itemPressedBack; c.ItemPressedBorder=border; c.ItemText=headerText; c.MenuBackground=background; c.MenuBorder=border; c.MenuSide=sideBack; return c; }
private static SideBarColors GetGradientColorScheme(eSideBarColorScheme scheme) { Color border=Color.Empty; Color back=Color.Empty; Color back2=Color.Empty; Color headerBack=Color.Empty; Color headerBack2=Color.Empty; Color headerHotBack=Color.Empty; Color headerText=Color.Empty; Color headerHotText=Color.Empty; Color sideBack=Color.Empty; Color sideBack2=Color.Empty; Color itemText=Color.Empty; Color itemHotBack=Color.Empty; Color itemHotBack2=Color.Empty; Color itemHotBorder=Color.Empty; Color itemHotText=Color.Empty; Color itemPressedBack=Color.Empty; Color itemPressedBack2=Color.Empty; Color itemCheckedBack=Color.Empty; Color itemCheckedBack2=Color.Empty; Color backText=Color.Empty; switch(scheme) { case eSideBarColorScheme.Blue: { border=Color.FromArgb(59,97,156); back=Color.FromArgb(232,232,232); back2=Color.White; sideBack=Color.FromArgb(200,220,248); sideBack2=Color.FromArgb(94,137,207); headerBack=Color.FromArgb(221,236,254); headerBack2=Color.FromArgb(133,171,228); headerText=Color.FromArgb(0,51,102); itemText=Color.Black; itemHotBack=Color.FromArgb(255,244,204); itemHotBack2=Color.FromArgb(255,209,147); itemHotBorder=Color.FromArgb(0,0,128); itemPressedBack=Color.FromArgb(254,142,75); itemPressedBack2=Color.FromArgb(255,207,139); itemCheckedBack=Color.FromArgb(255,213,140); itemCheckedBack2=Color.FromArgb(255,173,85); break; } case eSideBarColorScheme.Silver: { border=Color.FromArgb(87,86,113); back=Color.FromArgb(232,232,232); back2=Color.White; sideBack=Color.FromArgb(225,226,236); sideBack2=Color.FromArgb(126,125,157); headerBack=Color.FromArgb(243,244,250); headerBack2=Color.FromArgb(155,153,183); headerText=Color.FromArgb(87,86,113); itemText=Color.Black; itemHotBack=Color.FromArgb(255,244,204); itemHotBack2=Color.FromArgb(255,209,147); itemHotBorder=Color.FromArgb(87,86,113); itemPressedBack=Color.FromArgb(254,142,75); itemPressedBack2=Color.FromArgb(255,207,139); itemCheckedBack=Color.FromArgb(255,213,140); itemCheckedBack2=Color.FromArgb(255,173,85); break; } case eSideBarColorScheme.Green: { border=Color.FromArgb(96,128,88); back=Color.FromArgb(232,232,232); back2=Color.White; sideBack=Color.FromArgb(217,225,188); sideBack2=Color.FromArgb(151,170,111); headerBack=Color.FromArgb(244,247,222); headerBack2=Color.FromArgb(183,198,145); headerText=Color.FromArgb(85,114,78); itemText=Color.Black; itemHotBack=Color.FromArgb(255,244,204); itemHotBack2=Color.FromArgb(255,209,147); itemHotBorder=Color.FromArgb(96,128,88); itemPressedBack=Color.FromArgb(254,142,75); itemPressedBack2=Color.FromArgb(255,207,139); itemCheckedBack=Color.FromArgb(255,213,140); itemCheckedBack2=Color.FromArgb(255,173,85); break; } case eSideBarColorScheme.Orange: { border=Color.FromArgb(137,105,28); back=Color.FromArgb(232,232,232); back2=Color.White; sideBack=Color.FromArgb(249,225,164); sideBack2=Color.FromArgb(227,185,82); headerBack=Color.FromArgb(255,239,201); headerBack2=Color.FromArgb(242,210,132); headerText=Color.FromArgb(117,83,2); itemText=Color.Black; itemHotBack=Color.FromArgb(255,244,204); itemHotBack2=Color.FromArgb(255,209,147); itemHotBorder=Color.FromArgb(137,105,28); itemPressedBack=Color.FromArgb(254,142,75); itemPressedBack2=Color.FromArgb(255,207,139); itemCheckedBack=Color.FromArgb(255,213,140); itemCheckedBack2=Color.FromArgb(255,173,85); break; } case eSideBarColorScheme.Red: { border=Color.FromArgb(144,0,34); back=Color.FromArgb(232,232,232); back2=Color.White; sideBack=Color.FromArgb(255,174,193); sideBack2=Color.FromArgb(226,78,113); headerBack=Color.FromArgb(252,219,227); headerBack2=Color.FromArgb(254,150,174); headerText=Color.FromArgb(144,0,34); itemText=Color.Black; itemHotBack=Color.FromArgb(255,244,204); itemHotBack2=Color.FromArgb(255,209,147); itemHotBorder=Color.FromArgb(144,0,34); itemPressedBack=Color.FromArgb(254,142,75); itemPressedBack2=Color.FromArgb(255,207,139); itemCheckedBack=Color.FromArgb(255,213,140); itemCheckedBack2=Color.FromArgb(255,173,85); break; } case eSideBarColorScheme.LightBlue: { border=Color.FromArgb(81,100,136); back=Color.FromArgb(232,232,232); back2=Color.White; sideBack=Color.FromArgb(226,235,253); sideBack2=Color.FromArgb(175,190,218); headerBack=Color.FromArgb(255,255,255); headerBack2=Color.FromArgb(210,224,252); headerText=Color.FromArgb(69,84,115); itemText=Color.Black; itemHotBack=Color.FromArgb(255,244,204); itemHotBack2=Color.FromArgb(255,209,147); itemHotBorder=Color.FromArgb(81,100,136); itemPressedBack=Color.FromArgb(254,142,75); itemPressedBack2=Color.FromArgb(255,207,139); itemCheckedBack=Color.FromArgb(255,213,140); itemCheckedBack2=Color.FromArgb(255,173,85); break; } case eSideBarColorScheme.Money: { border=Color.FromArgb(44,72,112); back=Color.FromArgb(91,91,91); back2=Color.FromArgb(127,127,127); backText=Color.White; sideBack=Color.FromArgb(163,187,224); sideBack2=Color.FromArgb(99,131,177); headerBack=Color.FromArgb(77,108,152); headerBack2=Color.Empty; headerHotBack=Color.FromArgb(55,85,128); //Color.FromArgb(99,131,177); headerText=Color.White; itemText=Color.White; itemHotText=Color.FromArgb(255,223,127); headerHotText=Color.FromArgb(255,223,127); itemHotBack=Color.FromArgb(80,80,80); itemHotBack2=Color.FromArgb(60,60,60); itemHotBorder=Color.Black; itemPressedBack=Color.FromArgb(110,110,110); itemPressedBack2=Color.FromArgb(80,80,80); itemCheckedBack=Color.FromArgb(60,60,60); itemCheckedBack2=Color.FromArgb(80,80,80); break; } } SideBarColors c=new SideBarColors(); c.Background=back; c.Background2=back2; c.Border=border; c.HeaderBackground=headerBack; c.HeaderBackground2=headerBack2; c.HeaderSideBackground=sideBack; c.HeaderSideBackground2=sideBack2; c.HeaderText=headerText; c.HeaderHotText=headerHotText; if(headerHotBack.IsEmpty) { c.HeaderHotBackground=headerBack2; c.HeaderHotBackground2=headerBack; } else { c.HeaderHotBackground=headerHotBack; } c.HeaderSideHotBackground=headerBack2; c.HeaderSideHotBackground2=headerBack; c.ItemCheckedBorder=itemHotBorder; c.ItemCheckedText=itemText; if(itemHotText.IsEmpty) c.ItemHotText=itemText; else c.ItemHotText=itemHotText; c.ItemHotBackground=itemHotBack; c.ItemHotBackground2=itemHotBack2; c.ItemHotBorder=itemHotBorder; c.ItemPressedText=itemText; c.ItemPressedBackground=itemPressedBack; c.ItemPressedBackground2=itemPressedBack2; c.ItemPressedBorder=itemHotBorder; c.ItemText=itemText; c.MenuBackground=back; c.MenuBackground2=back2; c.MenuBorder=itemHotBorder; c.MenuSide=sideBack; c.MenuSide=sideBack2; c.BackgroundText=backText; return c; }
private static SideBarColors GetColorScheme(eSideBarColorScheme scheme) { SideBarColors colors=null; switch(scheme) { case eSideBarColorScheme.Brick: case eSideBarColorScheme.Marine: case eSideBarColorScheme.Plum: case eSideBarColorScheme.Pumpkin: case eSideBarColorScheme.Fire: case eSideBarColorScheme.Rose: case eSideBarColorScheme.Slate: case eSideBarColorScheme.Spruce: case eSideBarColorScheme.Storm: case eSideBarColorScheme.Sunset: case eSideBarColorScheme.Wheat: { colors=GetFlatColorScheme(scheme); break; } case eSideBarColorScheme.Blue: case eSideBarColorScheme.Silver: case eSideBarColorScheme.Green: case eSideBarColorScheme.Orange: case eSideBarColorScheme.Red: case eSideBarColorScheme.LightBlue: case eSideBarColorScheme.Money: { colors=GetGradientColorScheme(scheme); break; } case eSideBarColorScheme.SystemColors: { colors=GetSystemColorScheme(); break; } } return colors; }
public static void ApplyColorScheme(ColorScheme cs, eSideBarColorScheme scheme) { SideBarColors colors=SideBar.GetColorScheme(scheme); colors.Apply(cs); }
public static void ApplyColorScheme(SideBarPanelItem item, eSideBarColorScheme scheme) { SideBarColors colors=SideBar.GetColorScheme(scheme); colors.Apply(item); }