02-13-2013 08:49 AM
I am trying change the color of the slide fill style to match the current range fill when the ValueEnterRange event is fired. How do you obtain the range fill style properties? I can get the style from the ScaleRangeFillEventArgs parameter "e" (ScaleRangeFillStyle style = e.ScaleRangeFill.Style 😉 but there are no properties associated with the style.
02-14-2013 12:32 PM
Hi justwakingup,
You can create a new ScaleRangeFillStyle using the CreateSolidStyle Method, which creates a solid fill of a specified color. The ScaleRangeFillStyle Class also has a method to create a gradient style, and create a fill style that is drawn using a particular fill style and a given color.
Regards,
Alexandra
02-14-2013 01:23 PM
I have a property editor that allows the end user of the application create the RangeFills. I need to read back the colors that they have chosen. Is there a way to do this? Almost every other color property of the control that I tried to find is available.
02-15-2013 09:18 AM
Hi justwakingup,
Based on the documentation in our Help files, I see no way to get the color back once it is set.
Regards,
Alexandra
02-24-2013 09:31 PM
For anyone interested in solving this issue I found this work around using Type Converters
//Convert Range Fill Styles to string
TypeConverter styleCon = TypeDescriptor.GetConverter(typeof(ScaleRangeFillStyle));
foreach (ScaleRangeFill range in BarGauge.RangeFills)
{
string strFill = styleCon.ConvertToString(range.Style);
}
//Restore the range fill styles
BarGauge.RangeFills[i].Style = (ScaleRangeFillStyle)styleCon.ConvertFromString(strFill);
This allows you to convert the style to a string which will look something like : "Solid: Blue" for a solid blue fill style. I then parsed the string to get the color and used a Color Converter like this
TypeConverter colorCon = TypeDescriptor.GetConverter(typeof(Color));
BarGauge.FillColor = (Color)colorCon.ConvertFromString(strColor);