// If the H, S, or V values change, use this // code to update the RGB values and invalidate // the color wheel (so it updates the pointers). // Check the isInUpdate flag to avoid recursive events // when you update the NumericUpdownControls. private void HandleHSVScroll(object sender, ScrollEventArgs e) { _changeType = ChangeStyle.HSV; HSV = new DRColor.HSV(hsbHue.Value, hsbSaturation.Value, hsbBrightness.Value); SetRGB(new DRColor.RGB(HSV)); SetHSVLabels(HSV); this.Invalidate(); RainbowUtils.fillBoth(RGB); }
// If the R, G, or B values change, use this // code to update the HSV values and invalidate // the color wheel (so it updates the pointers). // Check the isInUpdate flag to avoid recursive events // when you update the NumericUpdownControls. private void HandleRGBScroll(object sender, ScrollEventArgs e) { _changeType = ChangeStyle.RGB; RGB = new DRColor.RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value); SetHSV(new DRColor.HSV(RGB)); SetRGBLabels(RGB); this.Invalidate(); RainbowUtils.fillBoth(RGB); }
private void colorWheel_Changed(object sender, ColorChangedEventArgs e) { if (e.RGB == null || e.HSV == null) { return; } SetRGB(e.RGB); SetHSV(e.HSV); RainbowUtils.fillBoth(e.RGB); }