assign visual style
Hey all.
I'm using Visual Studio 2017. I have made a usercontrol that allows the user to choose a visual style for the gauge during runtime.
I have tried using dgScale1.VisualStyle = Convert.ToString(Properties.Settings.Default.scale1theme); and a few other variations but i keep getting the error Cannot implicitly convert type 'string' to 'Syncfusion.Windows.Forms.Gauge.ThemeStyle'.
Just curious about how I would assign a visual style during runtime?
Thank you in advance.
SIGN IN To post a reply.
1 Reply
MK
Mallika Kannan
Syncfusion Team
November 10, 2017 07:34 AM UTC
Hi Travis
Thank you for contacting Syncfusion support.
Yes, we can provide an example that will showcase to apply the Visual Style in DigitalGauge at Run Time.
Please make use of the below code example:
Code Example [C#]
|
//For None
if ((sender as ComboBoxAdv).SelectedItem.ToString() == "None")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.None;
}
//Blue Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Blue")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Blue;
}
//Silver Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Silver")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Silver;
}
//Black Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Black")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Black;
}
// Metro Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Metro")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Metro;
}
//Custom Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Custom")
{
Syncfusion.Windows.Forms.Gauge.DigitalGaugeThemeBrush digitalGaugeThemeBrush1 = newSyncfusion.Windows.Forms.Gauge.DigitalGaugeThemeBrush();
digitalGaugeThemeBrush1.ForeColor = System.Drawing.Color.Yellow;
digitalGaugeThemeBrush1.FrameBorderColor = System.Drawing.Color.Red;
digitalGaugeThemeBrush1.OuterFrameGradientEndColor = System.Drawing.Color.Green;
this.digitalGauge1.ThemeBrush.Add(digitalGaugeThemeBrush1);
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Custom;
}
//Office2016Black Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Office2016Black")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016Black;
}
//Office2016Colorful Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Office2016Colorful")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016Colorful;
}
// Office2016DarkGray Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Office2016DarkGray")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016DarkGray;
}
//Office2016White Visuall Style
else if ((sender as ComboBoxAdv).SelectedItem.ToString() == "Office2016White")
{
this.digitalGauge1.VisualStyle = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Office2016White;
} |
Screenshot
We have also prepared the sample for your reference. It can be downloaded from the below link,
And also this below documentation will guide in requested use case.
Kindly check the above solution and let us know if it is helpful.
Regards,
Mallika
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
TM Travis Marquis
- Nov 10, 2017 02:05 AM UTC
- Nov 10, 2017 07:34 AM UTC