using System.Drawing; using FastReport.DevComponents.DotNetBar; using FastReport.DevComponents.DotNetBar.Rendering; namespace FastReport.Utils { /// /// The style of FastReport user interface. /// public enum UIStyle { /// /// Specifies the Microsoft Office 2003 style (blue). /// Office2003, /// /// Specifies the Microsoft Office 2007 style (blue). /// Office2007Blue, /// /// Specifies the Microsoft Office 2007 style (silver). /// Office2007Silver, /// /// Specifies the Microsoft Office 2007 style (black). /// Office2007Black, /// /// Specifies the Office 2010 (Blue) style. /// Office2010Blue, /// /// Specifies the Office 2010 (Silver) style. /// Office2010Silver, /// /// Specifies the Office 2010 (Black) style. /// Office2010Black, /// /// Specifies the Office 2013 style. /// Office2013, /// /// Specifies the Microsoft Visual Studio 2005 style. /// VisualStudio2005, /// /// Specifies the Visual Studio 2010 style. /// VisualStudio2010, /// /// Specifies the Visual Studio 2012 (Light) style. /// VisualStudio2012Light, /// /// Specifies the Microsoft Vista style (black). /// VistaGlass } /// /// Contains conversion methods between FastReport's UIStyle to various enums. /// public static class UIStyleUtils { internal const UIStyle DefaultStyle = UIStyle.VisualStudio2012Light; /// /// Contains visual style names. /// public static readonly string[] UIStyleNames = new string[] { "Office 2003", "Office 2007 Blue", "Office 2007 Silver", "Office 2007 Black", "Office 2010 Blue", "Office 2010 Silver", "Office 2010 Black", "Office 2013", "VisualStudio 2005", "VisualStudio 2010", "VisualStudio 2012", "VistaGlass" }; internal static bool IsOffice2007Scheme(UIStyle style) { return style == UIStyle.Office2007Blue || style == UIStyle.Office2007Silver || style == UIStyle.Office2007Black || style == UIStyle.Office2010Blue || style == UIStyle.Office2010Silver || style == UIStyle.Office2010Black || style == UIStyle.VistaGlass; } /// /// Converts FastReport's UIStyle to eDotNetBarStyle. /// /// Style to convert. /// Value of eDotNetBarStyle type. public static eDotNetBarStyle GetDotNetBarStyle(UIStyle style) { switch (style) { case UIStyle.VisualStudio2005: return eDotNetBarStyle.VS2005; case UIStyle.Office2003: return eDotNetBarStyle.Office2003; case UIStyle.Office2007Blue: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2007ColorTable(eOffice2007ColorScheme.Blue); return eDotNetBarStyle.Office2007; case UIStyle.Office2007Silver: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2007ColorTable(eOffice2007ColorScheme.Silver); return eDotNetBarStyle.Office2007; case UIStyle.Office2007Black: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2007ColorTable(eOffice2007ColorScheme.Black); return eDotNetBarStyle.Office2007; case UIStyle.Office2010Blue: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2010ColorTable(eOffice2010ColorScheme.Blue); return eDotNetBarStyle.Office2010; case UIStyle.Office2010Silver: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2010ColorTable(eOffice2010ColorScheme.Silver); return eDotNetBarStyle.Office2010; case UIStyle.Office2010Black: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2010ColorTable(eOffice2010ColorScheme.Black); return eDotNetBarStyle.Office2010; case UIStyle.VistaGlass: ((Office2007Renderer)GlobalManager.Renderer).ColorTable = new Office2007ColorTable(eOffice2007ColorScheme.VistaGlass); return eDotNetBarStyle.Office2007; } return eDotNetBarStyle.StyleManagerControlled; } /// /// Converts FastReport's UIStyle to eTabStripStyle. /// /// Style to convert. /// Value of eTabStripStyle type. public static eTabStripStyle GetTabStripStyle(UIStyle style) { switch (style) { case UIStyle.VisualStudio2005: return eTabStripStyle.VS2005Document; case UIStyle.Office2003: return eTabStripStyle.Office2003; case UIStyle.Office2007Blue: case UIStyle.Office2007Silver: case UIStyle.Office2007Black: case UIStyle.VistaGlass: return eTabStripStyle.Office2007Document; case UIStyle.Office2010Black: case UIStyle.Office2010Blue: case UIStyle.Office2010Silver: case UIStyle.VisualStudio2010: return eTabStripStyle.Office2007Dock; } return eTabStripStyle.Metro; } /// /// Converts FastReport's UIStyle to eTabStripStyle. /// /// Style to convert. /// Value of eTabStripStyle type. public static eTabStripStyle GetTabStripStyle1(UIStyle style) { switch (style) { case UIStyle.VisualStudio2005: return eTabStripStyle.VS2005; case UIStyle.Office2003: return eTabStripStyle.Office2003; case UIStyle.Office2007Blue: case UIStyle.Office2007Silver: case UIStyle.Office2007Black: case UIStyle.VistaGlass: return eTabStripStyle.Office2007Dock; case UIStyle.Office2010Black: case UIStyle.Office2010Blue: case UIStyle.Office2010Silver: case UIStyle.VisualStudio2010: return eTabStripStyle.Office2007Dock; } return eTabStripStyle.Metro; } /// /// Converts FastReport's UIStyle to eOffice2007ColorScheme. /// /// Style to convert. /// Value of eOffice2007ColorScheme type. public static eOffice2007ColorScheme GetOffice2007ColorScheme(UIStyle style) { switch (style) { case UIStyle.Office2007Blue: case UIStyle.Office2010Blue: return eOffice2007ColorScheme.Blue; case UIStyle.Office2007Silver: case UIStyle.Office2010Silver: return eOffice2007ColorScheme.Silver; case UIStyle.Office2007Black: case UIStyle.Office2010Black: return eOffice2007ColorScheme.Black; case UIStyle.VistaGlass: return eOffice2007ColorScheme.VistaGlass; } return eOffice2007ColorScheme.Blue; } /// /// Returns app workspace color for the given style. /// /// UI style. /// The color. public static Color GetAppWorkspaceColor(UIStyle style) { switch (style) { case UIStyle.Office2003: return Color.FromArgb(144, 153, 174); case UIStyle.Office2007Blue: return Color.FromArgb(101, 145, 205); case UIStyle.Office2007Silver: return Color.FromArgb(156, 160, 167); case UIStyle.Office2007Black: return Color.FromArgb(90, 90, 90); case UIStyle.Office2010Blue: return Color.FromArgb(101, 145, 205); case UIStyle.Office2010Silver: return Color.FromArgb(156, 160, 167); case UIStyle.Office2010Black: return Color.FromArgb(90, 90, 90); case UIStyle.VistaGlass: return Color.FromArgb(90, 90, 90); } return Color.FromArgb(239, 239, 242); } /// /// Returns control color for the given style. /// /// UI style. /// The color. public static Color GetControlColor(UIStyle style) { switch (style) { case UIStyle.Office2003: return Color.FromArgb(182, 208, 248); case UIStyle.Office2007Blue: return Color.FromArgb(180, 212, 255); case UIStyle.Office2007Silver: return Color.FromArgb(215, 214, 228); case UIStyle.Office2007Black: return Color.FromArgb(204, 207, 212); case UIStyle.Office2010Blue: return Color.FromArgb(215, 228, 242); case UIStyle.Office2010Silver: return Color.FromArgb(229, 233, 237); case UIStyle.Office2010Black: return Color.FromArgb(200, 200, 200); case UIStyle.VisualStudio2010: return Color.FromArgb(188, 199, 216); case UIStyle.VisualStudio2012Light: return Color.FromArgb(230, 231, 232); case UIStyle.VistaGlass: return Color.FromArgb(218, 224, 239); } return GetAppWorkspaceColor(style); } internal static Color GetGrayColor(UIStyle style) { switch (style) { case UIStyle.VisualStudio2005: return SystemColors.Control; case UIStyle.Office2003: return Color.FromArgb(145, 180, 230); case UIStyle.Office2007Blue: return Color.FromArgb(170, 210, 255); case UIStyle.Office2007Silver: case UIStyle.Office2010Silver: case UIStyle.Office2013: case UIStyle.VisualStudio2012Light: return Color.FromArgb(192, 193, 194); case UIStyle.VisualStudio2010: return Color.FromArgb(188, 199, 216); case UIStyle.Office2007Black: return Color.FromArgb(143, 150, 160); case UIStyle.VistaGlass: return Color.FromArgb(190, 200, 227); } return SystemColors.Control; } } }