private void SetRgb(float h, float s, float v) { slider4.ValueChanged -= slider4ValueChanged; slider5.ValueChanged -= slider5ValueChanged; slider6.ValueChanged -= slider6ValueChanged; var rgb = HsvRgbConverter.ToRgb(h, s, v); slider4.Value = (byte)rgb.R; slider5.Value = (byte)rgb.G; slider6.Value = (byte)rgb.B; SetColor((byte)slider4.Value, (byte)slider5.Value, (byte)slider6.Value); slider4.ValueChanged += slider4ValueChanged; slider5.ValueChanged += slider5ValueChanged; slider6.ValueChanged += slider6ValueChanged; }
private void SetHsv(int r, int g, int b) { slider1.ValueChanged -= slider1ValueChanged; slider2.ValueChanged -= slider2ValueChanged; slider3.ValueChanged -= slider3ValueChanged; var hsv = HsvRgbConverter.ToHsv(r, g, b); slider1.Value = (double)hsv.H; slider2.Value = (double)hsv.S; slider3.Value = (double)hsv.V; SetColor((byte)slider4.Value, (byte)slider5.Value, (byte)slider6.Value); slider1.ValueChanged += slider1ValueChanged; slider2.ValueChanged += slider2ValueChanged; slider3.ValueChanged += slider3ValueChanged; }