/// <summary> /// Sets the selected color. /// </summary> /// <param name="color">Color to set.</param> /// <param name="onlyHue">Determines whether only the hue should be set.</param> /// <param name="reset">Determines whether the "before" color should be set as well.</param> public void SetColor(Color color, bool onlyHue = false, bool reset = false) { updateControls(color); if (reset) { before.Color = color; } colorSlider.SelectedColor = color; lerpBox.SetColor(color, onlyHue); after.Color = color; }
/// <summary> /// Sets the selected color. /// </summary> /// <param name="color">Color to set.</param> /// <param name="onlyHue">Determines whether only the hue should be set.</param> /// <param name="reset">Determines whether the "before" color should be set as well.</param> public void SetColor(Color color, bool onlyHue = false, bool reset = false) { UpdateControls(color); if (reset) { m_Before.Color = color; } m_ColorSlider.SelectedColor = color; m_LerpBox.SetColor(color, onlyHue); m_After.Color = color; }
private void NumericTyped(ControlBase control, EventArgs args) { NumericUpDown box = control as NumericUpDown; if (box == null) { return; } int value = (int)box.Value; if (value < 0) { value = 0; } if (value > 255) { value = 255; } Color newColor = SelectedColor; if (box == m_Red) { newColor = new Color(SelectedColor.A, value, SelectedColor.G, SelectedColor.B); } else if (box == m_Green) { newColor = new Color(SelectedColor.A, SelectedColor.R, value, SelectedColor.B); } else if (box == m_Blue) { newColor = new Color(SelectedColor.A, SelectedColor.R, SelectedColor.G, value); } //else if (box.Name.Contains("Alpha")) // newColor = Color.FromArgb(textValue, SelectedColor.R, SelectedColor.G, SelectedColor.B); m_ColorSlider.SetColor(newColor, false); m_LerpBox.SetColor(newColor, false, false); m_After.Color = newColor; if (ColorChanged != null) { ColorChanged.Invoke(this, EventArgs.Empty); } }