void UpdateColors(ThemeChoiceControl themeChoiceControl, string text) { if (Mainform.RestoreColors.Count > 0) { foreach (KeyValuePair <string, Color> colors in Mainform.RestoreColors) { if (colors.Key == text) { themeChoiceControl.buttonEdit1.Text = ColorTranslator.ToHtml(colors.Value);; themeChoiceControl.buttonEditChildButton1.MetroColor = colors.Value; } } } }
public void UpdateRadialGaugeCustomTheme() { for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++) { ThemeChoiceControl themeChoiceControl = (ThemeChoiceControl)this.flowLayoutPanel1.Controls[i]; if (themeChoiceControl.BrushName.Text == "BackgroundColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#b2b2b2"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#262626"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#323031"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#ECF4FC"; } } else if (themeChoiceControl.BrushName.Text == "OuterFrameBackgroundColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#c5c5c5"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#6a6a6a"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#E6E6E6"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#363636"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#CEDDEE"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#BDCAD9"; } } else if (themeChoiceControl.BrushName.Text == "InnerFrameBackgroundColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#ffffff"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#b2b2b2"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#262626"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#232021"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#849DBD"; } } else if (themeChoiceControl.BrushName.Text == "ArcColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#262626"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#B5B5B5"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#686868"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#5F6F77"; } } else if (themeChoiceControl.BrushName.Text == "MinorTickMarkColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#444444"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#ACACAC"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#444444"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#5F6F77"; } } else if (themeChoiceControl.BrushName.Text == "MajorTickMarkColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#3d3d3d"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#3D3D3D"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#737373"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#686868"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#5F6F77"; } } else if (themeChoiceControl.BrushName.Text == "InterLinesColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#3d3d3d"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#3D3D3D"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#737373"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#686868"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#5F6F77"; } } else if (themeChoiceControl.BrushName.Text == "NeedlePointerColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#0173c7"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#0173c7"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#0173c7"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#0173c7"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#11b4cd"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#5F6F77"; } } else if (themeChoiceControl.BrushName.Text == "ScaleLabelColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#000000"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#444445"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#808080"; } } else if (themeChoiceControl.BrushName.Text == "GaugeLabelColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#000000"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#444445"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#808080"; } } else if (themeChoiceControl.BrushName.Text == "GaugeValueColor") { if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Colorful) { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016DarkGray) { themeChoiceControl.buttonEdit1.Text = "#000000"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016White) { themeChoiceControl.buttonEdit1.Text = "#444445"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Office2016Black) { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Metro) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Black) { themeChoiceControl.buttonEdit1.Text = "#808080"; } else if (this.radialGauge1.VisualStyle == ThemeStyle.Blue) { themeChoiceControl.buttonEdit1.Text = "#808080"; } } if (themeChoiceControl.buttonEdit1.Text.ToLower().ToString() == "#ffffff") { themeChoiceControl.buttonEditChildButton1.MetroColor = Color.Wheat; } else { themeChoiceControl.buttonEditChildButton1.MetroColor = ColorTranslator.FromHtml(themeChoiceControl.buttonEdit1.Text); } } }
public Form1() { InitializeComponent(); BrushNames.Add("BackgroundColor"); BrushNames.Add("OuterFrameBackgroundColor"); BrushNames.Add("InnerFrameBackgroundColor"); BrushNames.Add("ArcColor"); BrushNames.Add("MinorTickMarkColor"); BrushNames.Add("MajorTickMarkColor"); BrushNames.Add("InterLinesColor"); BrushNames.Add("ScaleLabelColor"); BrushNames.Add("NeedlePointerColor"); BrushNames.Add("GaugeLabelColor"); BrushNames.Add("GaugeValueColor"); for (int i = 0; i < 11; i++) { ThemeChoiceControl themeChoiceControl = new ThemeChoiceControl(); themeChoiceControl.Padding = new System.Windows.Forms.Padding(themeChoiceControl.Padding.Left, themeChoiceControl.Padding.Top, themeChoiceControl.Padding.Right, themeChoiceControl.Padding.Bottom); themeChoiceControl.ColorPicker.Picked += ColorPicker_Picked; themeChoiceControl.BrushName.Text = BrushNames[i]; if (themeChoiceControl.BrushName.Text == "BackgroundColor") { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (themeChoiceControl.BrushName.Text == "OuterFrameBackgroundColor") { themeChoiceControl.buttonEdit1.Text = "#c5c5c5"; } else if (themeChoiceControl.BrushName.Text == "InnerFrameBackgroundColor") { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } else if (themeChoiceControl.BrushName.Text == "ArcColor") { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } else if (themeChoiceControl.BrushName.Text == "ArcColor") { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } else if (themeChoiceControl.BrushName.Text == "MinorTickMarkColor") { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } else if (themeChoiceControl.BrushName.Text == "MajorTickMarkColor") { themeChoiceControl.buttonEdit1.Text = "#3d3d3d"; } else if (themeChoiceControl.BrushName.Text == "InterLinesColor") { themeChoiceControl.buttonEdit1.Text = "#3d3d3d"; } else if (themeChoiceControl.BrushName.Text == "NeedlePointerColor") { themeChoiceControl.buttonEdit1.Text = "#0173c7"; } else if (themeChoiceControl.BrushName.Text == "ScaleLabelColor") { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } else if (themeChoiceControl.BrushName.Text == "GaugeLabelColor") { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } else if (themeChoiceControl.BrushName.Text == "GaugeValueColor") { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } if (themeChoiceControl.buttonEdit1.Text == "#FFFFFF") { themeChoiceControl.buttonEditChildButton1.MetroColor = Color.Wheat; } else { themeChoiceControl.buttonEditChildButton1.MetroColor = ColorTranslator.FromHtml(themeChoiceControl.buttonEdit1.Text); } this.flowLayoutPanel1.Controls.Add(themeChoiceControl); } this.comboBoxAdv1.DropDownButton.MetroArrowColor = Color.Black; this.radialGauge1.ReadOnly = false; this.linearGauge1.ReadOnly = false; this.flowLayoutPanel1.BackColor = ColorTranslator.FromHtml("#f5f5f5"); this.radialGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016Colorful; this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016Colorful; this.linearGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016Colorful; this.radialGauge1.Value = 25; this.digitalGauge1.Value = "1234"; this.linearGauge1.Value = 25; this.comboBoxAdv1.SelectedIndexChanged += ComboBoxAdv1_SelectedIndexChanged; this.RadialGaugePanel.SizeChanged += new EventHandler(RadialGaugePanel_SizeChanged); this.LinearGaugePanel.SizeChanged += new EventHandler(LinearGaugePanel_SizeChanged); this.DigitalGaugePanel.SizeChanged += new EventHandler(DigitalGaugePanel_SizeChanged); this.RadialGaugePanel.Paint += new PaintEventHandler(RadialGaugePanel_Paint); this.LinearGaugePanel.Paint += new PaintEventHandler(LinearGaugePanel_Paint); this.radialGauge1.MinorDifference = 10; }
public CustomVisualStyleDialog(Form1 form) { Mainform = form; InitializeComponent(); BrushNames.Add("BackgroundColor"); BrushNames.Add("OuterFrameBackgroundColor"); BrushNames.Add("InnerFrameBackgroundColor"); BrushNames.Add("ArcColor"); BrushNames.Add("MinorTickMarkColor"); BrushNames.Add("MajorTickMarkColor"); BrushNames.Add("InterLinesColor"); BrushNames.Add("ScaleLabelColor"); BrushNames.Add("NeedlePointerColor"); BrushNames.Add("GaugeLabelColor"); BrushNames.Add("GaugeValueColor"); for (int i = 0; i < 11; i++) { ThemeChoiceControl themeChoiceControl = new ThemeChoiceControl(); themeChoiceControl.Padding = new System.Windows.Forms.Padding(themeChoiceControl.Padding.Left, themeChoiceControl.Padding.Top, themeChoiceControl.Padding.Right, themeChoiceControl.Padding.Bottom); themeChoiceControl.ColorPicker.Picked += ColorPicker_Picked; themeChoiceControl.BrushName.Text = BrushNames[i]; if (themeChoiceControl.BrushName.Text == "BackgroundColor") { if (Mainform.RestoreColors.Keys.Contains <string>("BackgroundColor")) { UpdateColors(themeChoiceControl, "BackgroundColor"); } else { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } } else if (themeChoiceControl.BrushName.Text == "OuterFrameBackgroundColor") { if (Mainform.RestoreColors.Keys.Contains <string>("OuterFrameBackgroundColor")) { UpdateColors(themeChoiceControl, "OuterFrameBackgroundColor"); } else { themeChoiceControl.buttonEdit1.Text = "#c5c5c5"; } } else if (themeChoiceControl.BrushName.Text == "InnerFrameBackgroundColor") { if (Mainform.RestoreColors.Keys.Contains <string>("InnerFrameBackgroundColor")) { UpdateColors(themeChoiceControl, "InnerFrameBackgroundColor"); } else { themeChoiceControl.buttonEdit1.Text = "#FFFFFF"; } } else if (themeChoiceControl.BrushName.Text == "ArcColor") { if (Mainform.RestoreColors.Keys.Contains <string>("ArcColor")) { UpdateColors(themeChoiceControl, "ArcColor"); } else { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } } else if (themeChoiceControl.BrushName.Text == "MinorTickMarkColor") { if (Mainform.RestoreColors.Keys.Contains <string>("MinorTickMarkColor")) { UpdateColors(themeChoiceControl, "MinorTickMarkColor"); } else { themeChoiceControl.buttonEdit1.Text = "#b5b5b5"; } } else if (themeChoiceControl.BrushName.Text == "MajorTickMarkColor") { if (Mainform.RestoreColors.Keys.Contains <string>("MajorTickMarkColor")) { UpdateColors(themeChoiceControl, "MajorTickMarkColor"); } else { themeChoiceControl.buttonEdit1.Text = "#3d3d3d"; } } else if (themeChoiceControl.BrushName.Text == "InterLinesColor") { if (Mainform.RestoreColors.Keys.Contains <string>("InterLinesColor")) { UpdateColors(themeChoiceControl, "InterLinesColor"); } else { themeChoiceControl.buttonEdit1.Text = "#3d3d3d"; } } else if (themeChoiceControl.BrushName.Text == "NeedlePointerColor") { if (Mainform.RestoreColors.Keys.Contains <string>("NeedlePointerColor")) { UpdateColors(themeChoiceControl, "NeedlePointerColor"); } else { themeChoiceControl.buttonEdit1.Text = "#0173c7"; } } else if (themeChoiceControl.BrushName.Text == "ScaleLabelColor") { if (Mainform.RestoreColors.Keys.Contains <string>("ScaleLabelColor")) { UpdateColors(themeChoiceControl, "ScaleLabelColor"); } else { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } } else if (themeChoiceControl.BrushName.Text == "GaugeLabelColor") { if (Mainform.RestoreColors.Keys.Contains <string>("GaugeLabelColor")) { UpdateColors(themeChoiceControl, "GaugeLabelColor"); } else { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } } else if (themeChoiceControl.BrushName.Text == "GaugeValueColor") { if (Mainform.RestoreColors.Keys.Contains <string>("GaugeValueColor")) { UpdateColors(themeChoiceControl, "GaugeValueColor"); } else { themeChoiceControl.buttonEdit1.Text = "#5e5e5e"; } } if (themeChoiceControl.buttonEdit1.Text == "#FFFFFF") { themeChoiceControl.buttonEditChildButton1.MetroColor = Color.Wheat; } else { themeChoiceControl.buttonEditChildButton1.MetroColor = ColorTranslator.FromHtml(themeChoiceControl.buttonEdit1.Text); } this.flowLayoutPanel1.Controls.Add(themeChoiceControl); previousColors.Add(themeChoiceControl.BrushName.Text, themeChoiceControl.buttonEditChildButton1.MetroColor); } this.FormClosing += Form2_FormClosing; this.StartPosition = FormStartPosition.CenterParent; try { System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid1.ico")); this.Icon = ico; } catch { } }