public ColorSelector(IGraphicsDisplay graphicsDisplay, ColorSelectorDefinition colorSelectorDefinition)
: base(colorSelectorDefinition.BackgroundColor,
colorSelectorDefinition.BorderColor,
colorSelectorDefinition.BorderWidth,
graphicsDisplay,
colorSelectorDefinition.Bounds)
{
this.colorSelectorDefinition = colorSelectorDefinition;
// Create all our gauge sub-controls
List<Gauge> gauges = new List<Gauge>();
Color[] colorList = new Color[] { Color.Red, Color.Lime, Color.Blue, Color.DarkBlue };
byte[] markerValueList = new byte[]
{
this.colorSelectorDefinition.StartColor.R,
this.colorSelectorDefinition.StartColor.G,
this.colorSelectorDefinition.StartColor.B,
this.colorSelectorDefinition.StartColor.A
};
for (int i = 0; i < colorList.Length; i++)
{
Rectangle gaugeRectangle = new Rectangle(
this.Bounds.X + this.colorSelectorDefinition.GaugeHorizontalMargin,
this.Bounds.Y + this.Bounds.Height - ((GaugeCount - i) * (this.colorSelectorDefinition.GaugeWidth + this.colorSelectorDefinition.GaugeVerticalMargin)),
this.Bounds.Width - this.colorSelectorDefinition.GaugeHorizontalMargin * 2,
this.colorSelectorDefinition.GaugeWidth);
gauges.Add(
new HorizontalGauge(
this.colorSelectorDefinition.BackgroundColor,
graphicsDisplay,
gaugeRectangle,
this.colorSelectorDefinition.GaugeMarkerWidth,
colorList[i],
markerValueList[i] / 255.0f));
}
this.gaugeList = gauges.ToArray();
this.color = this.colorSelectorDefinition.StartColor;
this.HookGaugeEvents();
}