/// <summary> /// Get list of available skins /// </summary> /// <returns></returns> public static List <SkinInfoMx> GetSkins() { List <SkinInfoMx> skinList = new List <SkinInfoMx>(); for (int si = 0; si < Skins.Length; si++) { SkinInfoMx sInf = Skins[si]; if (sInf.LowDate == DateTime.MaxValue) { continue; // hidden } else if (sInf.Bonus && !BonusSkinsAvailable) { continue; // unavailable bonus skin } else if (sInf.LowDate != DateTime.MinValue) // check date range if defined { DateTime lowDate = new DateTime(DateTime.Now.Year, sInf.LowDate.Month, sInf.LowDate.Day); DateTime highDate = new DateTime(DateTime.Now.Year, sInf.HighDate.Month, sInf.HighDate.Day); if (lowDate.CompareTo(DateTime.Now.Date) <= 0 && highDate.CompareTo(DateTime.Now.Date) >= 0) { } // show only if within date range //else if (Security.IsAdministrator(SS.I.UserName)) { } else { continue; // outside of date range } } skinList.Add(sInf); } return(skinList); }
/// <summary> /// Set app look and feel /// </summary> /// <param name="lookAndFeelName"></param> /// <param name="userLookAndFeel"></param> public static Color SetLookAndFeel( string lookAndFeelName, UserLookAndFeel userLookAndFeel) { if (!SkinningEnabled) { //DevExpress.UserSkins.OfficeSkins.Register(); // (obsolete in V12) //BonusSkinsRegister(); SkinManager.EnableFormSkins(); // paint XtraForms with current skin SkinningEnabled = true; } Color fontColor = SystemColors.ControlText; // default font color if (lookAndFeelName == "Classic Windows 3D Style") { userLookAndFeel.Style = LookAndFeelStyle.Style3D; userLookAndFeel.UseWindowsXPTheme = true; } else if (lookAndFeelName == "Flat") // not used { userLookAndFeel.Style = LookAndFeelStyle.Flat; userLookAndFeel.UseWindowsXPTheme = true; } else if (lookAndFeelName == "UltraFlat") // not used { userLookAndFeel.Style = LookAndFeelStyle.UltraFlat; userLookAndFeel.UseWindowsXPTheme = true; } else // use a skin { SkinInfoMx si = GetSkinFromInternalName(lookAndFeelName); if (si == null) { si = GetSkinFromInternalName("Blue"); } if (si == null) { return(fontColor); // shouldn't happen } // Dynamically load the BonusSkinsAssembly if requested and not already loaded if (si.Bonus && !BonusSkinsRegistered) // be sure bonus skins are registered { if (!BonusSkinsRegister()) { lookAndFeelName = "Blue"; // default to blue on error si = GetSkinFromInternalName(lookAndFeelName); } } userLookAndFeel.Style = LookAndFeelStyle.Skin; userLookAndFeel.SetSkinStyle(lookAndFeelName); //UserLookAndFeel.Default.Style = LookAndFeelStyle.Skin; // set for static default object //UserLookAndFeel.Default.SetSkinStyle(lookAndFeelName); DevExpress.Skins.Skin currentSkin = DevExpress.Skins.CommonSkins.GetSkin(userLookAndFeel); Color captionColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonSkins.SkinGroupPanelCaptionTop); fontColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.ControlText); if (Lex.Contains(lookAndFeelName, "Black") || // if a black look set white font color Lex.Contains(lookAndFeelName, "Dark") || Lex.Contains(lookAndFeelName, "Sharp")) { fontColor = Color.White; } } return(fontColor); }