private void OnHsvColorWheelColorChanged(object sender, EventArgs e) { if (this.changingStack == 0) { this.changingStack++; Int32HsvColor hsvColor = this.hsvColorWheel.HsvColor; this.SetPropertyValueFromHsv(hsvColor); this.changingStack--; } }
private void OnValueSliderValueChanged(object sender, IndexEventArgs ce) { if (this.changingStack == 0) { this.changingStack++; Int32HsvColor hsvColor = this.hsvColorWheel.HsvColor; hsvColor.Value = (this.valueSlider.Value * 100) / 0xff; this.SetPropertyValueFromHsv(hsvColor); this.changingStack--; } }
private void DrawSelectorNub(IDrawingContext dc, double theta, double radius) { PointDouble center = new PointDouble((radius * this.wheelRadius) * Math.Cos(theta), (radius * this.wheelRadius) * Math.Sin(theta)); double num2 = this.selectorWidth / 2; Int32HsvColor hsvColor = this.hsvColor; hsvColor.Value = 100; this.selectorNubBrush.Color = base.Enabled ? hsvColor.ToGdipColor() : Color.Silver; dc.FillCircle(center, num2, this.selectorNubBrush); dc.DrawCircle(center, num2 - 1.0, whiteBrush, 1.0); dc.DrawCircle(center, num2, base.Enabled ? nubOutlineBrush : grayBrush, 1.0); }
private void SetPropertyValueFromRgb(int red, int green, int blue) { UIUtil.SuspendControlPainting(this); try { if (this.redNud.Value != red) { this.redNud.Value = red; } if (this.greenNud.Value != green) { this.greenNud.Value = green; } if (this.blueNud.Value != blue) { this.blueNud.Value = blue; } if (this.inOnPropertyValueChanged == 0) { int num = ((red << 0x10) | (green << 8)) | blue; if (base.Property.Value != num) { base.Property.Value = num; } } Int32HsvColor color2 = new Int32RgbColor(red, green, blue).ToHsv(); this.hsvColorWheel.HsvColor = color2; this.valueSlider.Value = (color2.Value * 0xff) / 100; this.saturationSlider.Value = (color2.Saturation * 0xff) / 100; Int32HsvColor color3 = color2; color3.Value = 0; Int32HsvColor color4 = color2; color4.Value = 100; this.valueSlider.MinColor = color3.ToGdipColor(); this.valueSlider.MaxColor = color4.ToGdipColor(); Int32HsvColor color5 = color2; color5.Saturation = 0; Int32HsvColor color6 = color2; color6.Saturation = 100; this.saturationSlider.MinColor = color5.ToGdipColor(); this.saturationSlider.MaxColor = color6.ToGdipColor(); } finally { UIUtil.ResumeControlPainting(this); if (UIUtil.IsControlPaintingEnabled(this)) { this.Refresh(); } } }
private void SetPropertyValueFromHsv(Int32HsvColor hsv) { UIUtil.SuspendControlPainting(this); try { Int32RgbColor color = hsv.ToRgb(); this.SetPropertyValueFromRgb(color.Red, color.Green, color.Blue); if (this.hsvColorWheel.HsvColor != hsv) { this.hsvColorWheel.HsvColor = hsv; } if (this.valueSlider.Value != ((hsv.Value * 0xff) / 100)) { this.valueSlider.Value = (hsv.Value * 0xff) / 100; } if (this.saturationSlider.Value != ((hsv.Saturation * 0xff) / 100)) { this.saturationSlider.Value = (hsv.Saturation * 0xff) / 100; } Int32HsvColor color2 = hsv; color2.Value = 0; Int32HsvColor color3 = hsv; color3.Value = 100; this.valueSlider.MinColor = color2.ToGdipColor(); this.valueSlider.MaxColor = color3.ToGdipColor(); Int32HsvColor color4 = hsv; color4.Saturation = 0; Int32HsvColor color5 = hsv; color5.Saturation = 100; this.saturationSlider.MinColor = color4.ToGdipColor(); this.saturationSlider.MaxColor = color5.ToGdipColor(); } finally { UIUtil.ResumeControlPainting(this); if (UIUtil.IsControlPaintingEnabled(this)) { this.Refresh(); } } }