void OnWheelColorChanged(object sender, EventArgs e) { m_selectedColor.Hue = m_colorWheel.SelectedHSLColor.Hue; m_selectedColor.Saturation = m_colorWheel.SelectedHSLColor.Saturation; SelectedHSLColor = m_selectedColor; }
void SetColor(PointF mousepoint) { if (WheelRectangle.Contains(mousepoint) == false) return; PointF center = Util.Center(ColorWheelRectangle); double radius = Radius(ColorWheelRectangle); double dx = Math.Abs(mousepoint.X - center.X); double dy = Math.Abs(mousepoint.Y - center.Y); double angle = Math.Atan(dy / dx) / Math.PI * 180; double dist = Math.Pow((Math.Pow(dx, 2) + (Math.Pow(dy, 2))), 0.5); double saturation = dist/radius; //if (dist > radius + 5) // give 5 pixels slack // return; if (dist < 6) saturation = 0; // snap to center if (mousepoint.X < center.X) angle = 180 - angle; if (mousepoint.Y > center.Y) angle = 360 - angle; SelectedHSLColor = new HSLColor(angle, saturation, SelectedHSLColor.Lightness); }
void OnLightnessColorChanged(object sender, EventArgs e) { m_selectedColor.Lightness = m_colorBar.SelectedHSLColor.Lightness; SelectedHSLColor = m_selectedColor; }
protected override void SetPercent(float percent) { base.SetPercent(percent); m_selectedColor.Lightness = percent / 100; SelectedHSLColor = m_selectedColor; }
private void colorWheel_SelectedColorChanged(object sender, EventArgs e) { selHSLColor = colorWheel.SelectedHSLColor; //selHSLColor.Lightness = colorSlider2.Percent; colorSlider2.SelectedHSLColor = selHSLColor; UpdateCMYKValues(); lblFinalColorValue.BackColor = SelectedColor; }
private void colorSlider2_SelectedValueChanged(object sender, EventArgs e) { selHSLColor = colorSlider2.SelectedHSLColor; colorWheel.SelectedHSLColor = selHSLColor; UpdateCMYKValues(); lblFinalColorValue.BackColor = SelectedColor; }