Beispiel #1
0
    private void CalcCoordsAndUpdate(ColorHandler.HSV HSV)
    {
        // Convert color to real-world coordinates and then calculate
        // the various points. HSV.Hue represents the degrees (0 to 360),
        // HSV.Saturation represents the radius.
        // This procedure doesn't draw anything--it simply
        // updates class-level variables. The UpdateDisplay
        // procedure uses these values to update the screen.

        // Given the angle (HSV.Hue), and distance from
        // the center (HSV.Saturation), and the center,
        // calculate the point corresponding to
        // the selected color, on the color wheel.
        colorPoint = GetPoint((double)HSV.Hue / 255 * 360,
                              (double)HSV.Saturation / 255 * radius,
                              centerPoint);

        // Given the brightness (HSV.value), calculate the
        // point corresponding to the brightness indicator.
        brightnessPoint = CalcBrightnessPoint(HSV.value);

        // Store information about the selected color.
        brightness    = HSV.value;
        selectedColor = ColorHandler.HSVtoColor(HSV);
        RGB           = ColorHandler.HSVtoRGB(HSV);

        // The full color is the same as HSV, except that the
        // brightness is set to full (255). This is the top-most
        // color in the brightness gradient.
        fullColor = ColorHandler.HSVtoColor(HSV.Hue, HSV.Saturation, 255);
    }
Beispiel #2
0
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form.
     RefreshValue(nudRed, RGB.Red);
     RefreshValue(nudBlue, RGB.Blue);
     RefreshValue(nudGreen, RGB.Green);
 }
 private void SetRGBLabels(ColorHandler.RGB RGB)
 {
     RefreshText(lblRed, RGB.Red);
     RefreshText(lblBlue, RGB.Blue);
     RefreshText(lblGreen, RGB.Green);
     this.txtWebColor.Text = ColorTranslator.ToHtml(Color.FromArgb(RGB.Red, RGB.Green, RGB.Blue)).ToString();
 }
Beispiel #4
0
 public void Draw(Graphics g, ColorHandler.RGB RGB)
 {
     // Given RGB values, calculate HSV and then update the screen.
     this.g   = g;
     this.HSV = ColorHandler.RGBtoHSV(RGB);
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form, but don't trigger the ValueChanged event of the form. The isInUpdate
     // variable ensures that the event procedures exit without doing anything.
     isInUpdate = true;
     UpdateColorInfo(RGB);
     isInUpdate = false;
 }
Beispiel #6
0
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form.
     RefreshValue(hsbRed, RGB.Red);
     RefreshValue(hsbBlue, RGB.Blue);
     RefreshValue(hsbGreen, RGB.Green);
     SetRGBLabels(RGB);
 }
        public void SetCurrentColor(Color c)
        {
            isInUpdate = true;
            changeType = ChangeStyle.RGB;
            RGB        = new ColorHandler.RGB(c.R, c.G, c.B);

            UpdateColorInfo(RGB);
            isInUpdate = false;
            this.Invalidate();
        }
Beispiel #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorWheel"/> class.
        /// </summary>
        /// <param name="r">
        /// The r.
        /// </param>
        /// <param name="g">
        /// The g.
        /// </param>
        /// <param name="b">
        /// The b.
        /// </param>
        public ColorWheel(int r, int g, int b)
        {
            color = new ColorHandler.RGB(r, g, b);
            InitializeComponent();
            this.Dock             = DockStyle.Top;
            this.Controls[0].Text = EntName;
            this.AutoSize         = false;

            // hsvColor = new ColorHandler.HSV(0, 0, brightness);
        }
Beispiel #9
0
 private void HandleRGBScroll(object sender, ScrollEventArgs e)
 {
     // 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.
     changeType = ChangeStyle.RGB;
     RGB        = new ColorHandler.RGB((int)nudRed.Value, (int)nudGreen.Value, (int)nudBlue.Value);
     SetHSV(ColorHandler.RGBtoHSV(RGB));
     this.Invalidate();
 }
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form, but don't trigger
     // the ValueChanged event of the form. The isInUpdate
     // variable ensures that the event procedures
     // exit without doing anything.
     isInUpdate = true;
     RefreshValue(nudRed, RGB.Red);
     RefreshValue(nudBlue, RGB.Blue);
     RefreshValue(nudGreen, RGB.Green);
     isInUpdate            = false;
     this.txtWebColor.Text = ColorTranslator.ToHtml(Color.FromArgb(RGB.Red, RGB.Green, RGB.Blue)).ToString();
 }
 private void NudValueChanged(object sender, EventArgs e)
 {
     // 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.
     if (!isInUpdate)
     {
         changeType = ChangeStyle.RGB;
         RGB        = new ColorHandler.RGB((int)nudRed.Value, (int)nudGreen.Value, (int)nudBlue.Value);
         UpdateColorInfo(RGB);
         this.Invalidate();
     }
 }
Beispiel #12
0
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form, but don't trigger
     // the ValueChanged event of the form. The isInUpdate
     // variable ensures that the event procedures
     // exit without doing anything.
     isInUpdate = true;
     RefreshValue(nudRed, RGB.Red);
     RefreshValue(nudBlue, RGB.Blue);
     RefreshValue(nudGreen, RGB.Green);
     RGBOUT     = RGB;
     isInUpdate = false;
 }
Beispiel #13
0
        /*
         * private HsvColor hsvColor;
         * public HsvColor HsvColor
         * {
         *  get
         *  {
         *      return hsvColor;
         *  }
         *
         *  set
         *  {
         *      if (hsvColor != value)
         *      {
         *          HsvColor oldColor = hsvColor;
         *          hsvColor = value;
         *          this.OnColorChanged();
         *          Refresh();
         *      }
         *  }
         * }
         */
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ColorWheel"/> class.
        /// </summary>
        public ColorWheel()
        {
            color = new ColorHandler.RGB(0, 0, 0);

            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.Dock             = DockStyle.Top;
            this.Controls[0].Text = EntName;
            this.AutoSize         = false;

            // hsvColor = new ColorHandler.HSV(0, 0, brightness);
        }
Beispiel #14
0
        /// <summary>
        /// The update box.
        /// </summary>
        public void updateBox()
        {
            colorBox.BackColor = ColorHandler.HSVtoColor(hsvColor);
            ColorHandler.RGB tempRGB = ColorHandler.HSVtoRGB(hsvColor);
            updatingColors = true;
            if (alphaText != null)
            {
                alphaText.Text = (this.color.Alpha / 255f).ToString();
            }

            redText.Text   = (this.color.Red / 255f).ToString();
            greenText.Text = (this.color.Green / 255f).ToString();
            blueText.Text  = (this.color.Blue / 255f).ToString();
            updatingColors = false;
        }
        private void UpdateColorInfo(ColorHandler.RGB RGB)
        {
            this.RGB        = RGB;
            btnOK.BackColor = ColorHandler.RGBtoColor(RGB);
            btnOK.ForeColor = (RGB.Red < 180 && RGB.Green < 180) ? Color.White : Color.Black;

            //update color info
            switch (cbColorInfo.SelectedItem.ToString())
            {
            case COLOR_INFO_RGB:
                RefreshNudValue(nudRed, RGB.Red);
                RefreshNudValue(nudBlue, RGB.Blue);
                RefreshNudValue(nudGreen, RGB.Green);
                break;

            case COLOR_INFO_HEX:
                string r = RGB.Red.ToString("X02");
                string g = RGB.Green.ToString("X02");
                string b = RGB.Blue.ToString("X02");

                isInUpdate       = true;
                tbFloatVals.Text = r + g + b;
                isInUpdate       = false;
                break;

            case COLOR_INFO_FLOAT:
                string r2 = ((float)Math.Round(RGB.Red / 255f, 2)).ToString("F02", CultureInfo.InvariantCulture);
                string g2 = ((float)Math.Round(RGB.Green / 255f, 2)).ToString("F02", CultureInfo.InvariantCulture);
                string b2 = ((float)Math.Round(RGB.Blue / 255f, 2)).ToString("F02", CultureInfo.InvariantCulture);

                isInUpdate       = true;
                tbFloatVals.Text = r2 + " " + g2 + " " + b2;
                isInUpdate       = false;
                break;
            }

            //dispatch event further
            EventHandler <ColorChangedEventArgs> handler = OnColorChanged;

            if (handler != null)
            {
                handler(this, new ColorChangedEventArgs(RGB, ColorHandler.RGBtoHSV(RGB)));
            }
        }
Beispiel #16
0
        //this sets lightProps values from sliders
        private void UpdateLightPropsFromSliders()
        {
            ColorHandler.RGB curColor     = colorPickerControl1.CurrentColor;
            bool             colorChanged = false; //need this check to allow relative mode to work properly

            if ((byte)curColor.Red != lightProps.Red || (byte)curColor.Green != lightProps.Green || (byte)curColor.Blue != lightProps.Blue)
            {
                lightProps.Red   = (byte)curColor.Red;
                lightProps.Green = (byte)curColor.Green;
                lightProps.Blue  = (byte)curColor.Blue;
                colorChanged     = true;
            }

            lightProps.PrimaryRadius = colorPickerSlider1.Value;
            if (showAllControls)
            {
                lightProps.SecondaryRadius = colorPickerSlider2.Value;
                lightProps.Interval        = colorPickerSlider3.Value;
            }
            UpdateSelection(colorChanged);
        }
        private void tbFloatVals_TextChanged(object sender, EventArgs e)
        {
            if (isInUpdate)
            {
                return;
            }

            if (COLOR_INFO[colorInfoMode].ToString() == COLOR_INFO_FLOAT)
            {
                string[] parts = tbFloatVals.Text.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length != 3)
                {
                    return;
                }

                ColorHandler.RGB rgb = new ColorHandler.RGB();

                float c;
                if (!float.TryParse(parts[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out c))
                {
                    return;
                }
                rgb.Red = (int)(General.Clamp(Math.Abs(c), 0.0f, 1.0f) * 255);

                if (!float.TryParse(parts[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out c))
                {
                    return;
                }
                rgb.Green = (int)(General.Clamp(Math.Abs(c), 0.0f, 1.0f) * 255);

                if (!float.TryParse(parts[2].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out c))
                {
                    return;
                }
                rgb.Blue = (int)(General.Clamp(Math.Abs(c), 0.0f, 1.0f) * 255);

                changeType = ChangeStyle.RGB;
                UpdateColorInfo(rgb);
                this.Invalidate();
            }
            else if (COLOR_INFO[colorInfoMode].ToString() == COLOR_INFO_HEX)
            {
                string hexColor = tbFloatVals.Text.Trim().Replace("-", "");
                if (hexColor.Length != 6)
                {
                    return;
                }

                ColorHandler.RGB rgb = new ColorHandler.RGB();
                int color;

                string colorStr = hexColor.Substring(0, 2);
                if (!int.TryParse(colorStr, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out color))
                {
                    return;
                }
                rgb.Red = color;

                colorStr = hexColor.Substring(2, 2);
                if (!int.TryParse(colorStr, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out color))
                {
                    return;
                }
                rgb.Green = color;

                colorStr = hexColor.Substring(4, 2);
                if (!int.TryParse(colorStr, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out color))
                {
                    return;
                }
                rgb.Blue = color;

                changeType = ChangeStyle.RGB;
                UpdateColorInfo(rgb);
                this.Invalidate();
            }
        }
Beispiel #18
0
    public void Draw(Graphics g, Point mousePoint)
    {
        // You've moved the mouse.
        // Now update the screen to match.

        double distance;
        int    degrees;
        Point  delta;
        Point  newColorPoint;
        Point  newBrightnessPoint;
        Point  newPoint;

        // Keep track of the previous color pointer point,
        // so you can put the mouse there in case the
        // user has clicked outside the circle.
        newColorPoint      = colorPoint;
        newBrightnessPoint = brightnessPoint;

        // Store this away for later use.
        this.g = g;

        if (currentState == MouseState.MouseUp)
        {
            if (!mousePoint.IsEmpty)
            {
                if (colorRegion.IsVisible(mousePoint))
                {
                    // Is the mouse point within the color circle?
                    // If so, you just clicked on the color wheel.
                    currentState = MouseState.ClickOnColor;
                }
                else if (brightnessRegion.IsVisible(mousePoint))
                {
                    // Is the mouse point within the brightness area?
                    // You clicked on the brightness area.
                    currentState = MouseState.ClickOnBrightness;
                }
                else
                {
                    // Clicked outside the color and the brightness
                    // regions. In that case, just put the
                    // pointers back where they were.
                    currentState = MouseState.ClickOutsideRegion;
                }
            }
        }

        switch (currentState)
        {
        case MouseState.ClickOnBrightness:
        case MouseState.DragInBrightness:
            // Calculate new color information
            // based on the brightness, which may have changed.
            newPoint = mousePoint;
            if (newPoint.Y < brightnessMin)
            {
                newPoint.Y = brightnessMin;
            }
            else if (newPoint.Y > brightnessMax)
            {
                newPoint.Y = brightnessMax;
            }
            newBrightnessPoint = new Point(brightnessX, newPoint.Y);
            brightness         = (int)((brightnessMax - newPoint.Y) * brightnessScaling);
            HSV.value          = brightness;
            RGB = ColorHandler.HSVtoRGB(HSV);
            break;

        case MouseState.ClickOnColor:
        case MouseState.DragInColor:
            // Calculate new color information
            // based on selected color, which may have changed.
            newColorPoint = mousePoint;

            // Calculate x and y distance from the center,
            // and then calculate the angle corresponding to the
            // new location.
            delta = new Point(
                mousePoint.X - centerPoint.X, mousePoint.Y - centerPoint.Y);
            degrees = CalcDegrees(delta);

            // Calculate distance from the center to the new point
            // as a fraction of the radius. Use your old friend,
            // the Pythagorean theorem, to calculate this value.
            distance = Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y) / radius;

            if (currentState == MouseState.DragInColor)
            {
                if (distance > 1)
                {
                    // Mouse is down, and outside the circle, but you
                    // were previously dragging in the color circle.
                    // What to do?
                    // In that case, move the point to the edge of the
                    // circle at the correct angle.
                    distance      = 1;
                    newColorPoint = GetPoint(degrees, radius, centerPoint);
                }
            }
            if (distance > 1)
            {
                distance = 1;
            }
            // Calculate the new HSV and RGB values.
            HSV.Hue        = (int)(degrees * 255 / 360);
            HSV.Saturation = (int)(distance * 255);
            HSV.value      = brightness;
            RGB            = ColorHandler.HSVtoRGB(HSV);
            fullColor      = ColorHandler.HSVtoColor(HSV.Hue, HSV.Saturation, 255);
            break;
        }
        selectedColor = ColorHandler.HSVtoColor(HSV);

        // Raise an event back to the parent form,
        // so the form can update any UI it's using
        // to display selected color values.
        OnColorChanged(RGB, HSV);

        // On the way out, set the new state.
        switch (currentState)
        {
        case MouseState.ClickOnBrightness:
            currentState = MouseState.DragInBrightness;
            break;

        case MouseState.ClickOnColor:
            currentState = MouseState.DragInColor;
            break;

        case MouseState.ClickOutsideRegion:
            currentState = MouseState.DragOutsideRegion;
            break;
        }

        // Store away the current points for next time.
        colorPoint      = newColorPoint;
        brightnessPoint = newBrightnessPoint;

        // Draw the gradients and points.
        UpdateDisplay();
    }
Beispiel #19
0
    protected void OnColorChanged(ColorHandler.RGB RGB, ColorHandler.HSV HSV)
    {
        ColorChangedEventArgs e = new ColorChangedEventArgs(RGB, HSV);

        ColorChanged(this, e);
    }
 private void SetRGB( ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form, but don't trigger
       // the ValueChanged event of the form. The isInUpdate
       // variable ensures that the event procedures
       // exit without doing anything.
       isInUpdate = true;
       RefreshValue(nudRed, RGB.Red);
       RefreshValue(nudBlue, RGB.Blue);
       RefreshValue(nudGreen, RGB.Green);
       RGBOUT = RGB;
       isInUpdate = false;
 }
 private void HandleRGBChange(object sender,  System.EventArgs e)
 {
     // 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.
       if (!isInUpdate )
       {
     changeType = ChangeStyle.RGB;
     RGB = new ColorHandler.RGB((int)nudRed.Value, (int)nudGreen.Value, (int)nudBlue.Value);
     SetHSV(ColorHandler.RGBtoHSV(RGB));
     RGBOUT = RGB;
     this.Invalidate();
       }
 }
 public ColorChangedEventArgs(ColorHandler.RGB RGB, ColorHandler.HSV HSV)
 {
     mRGB = RGB;
     mHSV = HSV;
 }
Beispiel #23
0
    private void CalcCoordsAndUpdate(ColorHandler.HSV HSV)
    {
        // Convert color to real-world coordinates and then calculate
        // the various points. HSV.Hue represents the degrees (0 to 360),
        // HSV.Saturation represents the radius.
        // This procedure doesn't draw anything--it simply
        // updates class-level variables. The UpdateDisplay
        // procedure uses these values to update the screen.

        // Given the angle (HSV.Hue), and distance from
        // the center (HSV.Saturation), and the center,
        // calculate the point corresponding to
        // the selected color, on the color wheel.
        colorPoint = GetPoint((double)HSV.Hue / 255 * 360,
            (double)HSV.Saturation / 255 * radius,
            centerPoint);

        // Given the brightness (HSV.value), calculate the
        // point corresponding to the brightness indicator.
        brightnessPoint = CalcBrightnessPoint(HSV.value);

        // Store information about the selected color.
        brightness = HSV.value;
        selectedColor = ColorHandler.HSVtoColor(HSV);
        RGB = ColorHandler.HSVtoRGB(HSV);

        // The full color is the same as HSV, except that the
        // brightness is set to full (255). This is the top-most
        // color in the brightness gradient.
        fullColor = ColorHandler.HSVtoColor(255, HSV.Hue, HSV.Saturation, 255);
    }
Beispiel #24
0
    public void Draw(Graphics g, Point mousePoint)
    {
        // You've moved the mouse.
        // Now update the screen to match.

        double distance;
        int degrees;
        Point delta;
        Point newColorPoint;
        Point newBrightnessPoint;
        Point newPoint;

        // Keep track of the previous color pointer point,
        // so you can put the mouse there in case the
        // user has clicked outside the circle.
        newColorPoint = colorPoint;
        newBrightnessPoint = brightnessPoint;

        // Store this away for later use.
        this.g = g;

        if (currentState == MouseState.MouseUp)
        {
            if (!mousePoint.IsEmpty)
            {
                if (colorRegion.IsVisible(mousePoint))
                {
                    // Is the mouse point within the color circle?
                    // If so, you just clicked on the color wheel.
                    currentState = MouseState.ClickOnColor;
                }
                else if (brightnessRegion.IsVisible(mousePoint))
                {
                    // Is the mouse point within the brightness area?
                    // You clicked on the brightness area.
                    currentState = MouseState.ClickOnBrightness;
                }
                else
                {
                    // Clicked outside the color and the brightness
                    // regions. In that case, just put the
                    // pointers back where they were.
                    currentState = MouseState.ClickOutsideRegion;
                }
            }
        }

        switch (currentState)
        {
            case MouseState.ClickOnBrightness:
            case MouseState.DragInBrightness:
                // Calculate new color information
                // based on the brightness, which may have changed.
                newPoint = mousePoint;
                if (newPoint.Y < brightnessMin)
                {
                    newPoint.Y = brightnessMin;
                }
                else if (newPoint.Y > brightnessMax)
                {
                    newPoint.Y = brightnessMax;
                }
                newBrightnessPoint = new Point(brightnessX, newPoint.Y);
                brightness = (int)((brightnessMax - newPoint.Y) * brightnessScaling);
                HSV.value = brightness;
                RGB = ColorHandler.HSVtoRGB(HSV);
                break;

            case MouseState.ClickOnColor:
            case MouseState.DragInColor:
                // Calculate new color information
                // based on selected color, which may have changed.
                newColorPoint = mousePoint;

                // Calculate x and y distance from the center,
                // and then calculate the angle corresponding to the
                // new location.
                delta = new Point(
                    mousePoint.X - centerPoint.X, mousePoint.Y - centerPoint.Y);
                degrees = CalcDegrees(delta);

                // Calculate distance from the center to the new point
                // as a fraction of the radius. Use your old friend,
                // the Pythagorean theorem, to calculate this value.
                distance = Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y) / radius;

                if (currentState == MouseState.DragInColor || distance > 1)
                {
                    if (distance > 1)
                    {
                        // Mouse is down, and outside the circle, but you
                        // were previously dragging in the color circle.
                        // What to do?
                        // In that case, move the point to the edge of the
                        // circle at the correct angle.
                        distance = 1;
                        newColorPoint = GetPoint(degrees, radius, centerPoint);
                    }
                }

                // Calculate the new HSV and RGB values.
                HSV.Hue = (int)(degrees * 255 / 360);
                HSV.Saturation = (int)(distance * 255);
                HSV.value = brightness;
                RGB = ColorHandler.HSVtoRGB(HSV);
                fullColor = ColorHandler.HSVtoColor(255, HSV.Hue, HSV.Saturation, 255);
                break;
        }
        selectedColor = ColorHandler.HSVtoColor(HSV);

        // Raise an event back to the parent form,
        // so the form can update any UI it's using
        // to display selected color values.
        OnColorChanged(RGB, HSV);

        // On the way out, set the new state.
        switch (currentState)
        {
            case MouseState.ClickOnBrightness:
                currentState = MouseState.DragInBrightness;
                break;
            case MouseState.ClickOnColor:
                currentState = MouseState.DragInColor;
                break;
            case MouseState.ClickOutsideRegion:
                currentState = MouseState.DragOutsideRegion;
                break;
        }

        // Store away the current points for next time.
        colorPoint = newColorPoint;
        brightnessPoint = newBrightnessPoint;

        // Draw the gradients and points.
        UpdateDisplay();
    }
 public ColorChangedEventArgs(ColorHandler.RGB RGB, ColorHandler.HSV HSV)
 {
     mRGB = RGB;
     mHSV = HSV;
 }
Beispiel #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorWheel"/> class.
        /// </summary>
        public ColorWheel()
        {
            color = new ColorHandler.RGB(0, 0, 0);

            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.Dock = DockStyle.Top;
            this.Controls[0].Text = EntName;
            this.AutoSize = false;

            // hsvColor = new ColorHandler.HSV(0, 0, brightness);
        }
Beispiel #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorWheel"/> class.
        /// </summary>
        /// <param name="r">
        /// The r.
        /// </param>
        /// <param name="g">
        /// The g.
        /// </param>
        /// <param name="b">
        /// The b.
        /// </param>
        public ColorWheel(int r, int g, int b)
        {
            color = new ColorHandler.RGB(r, g, b);
            InitializeComponent();
            this.Dock = DockStyle.Top;
            this.Controls[0].Text = EntName;
            this.AutoSize = false;

            // hsvColor = new ColorHandler.HSV(0, 0, brightness);
        }
 private void HandleRGBScroll(object sender, ScrollEventArgs e)
 {
     // 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.
     changeType = ChangeStyle.RGB;
     RGB = new ColorHandler.RGB(redSc.Value, greenSc.Value, blueSC.Value);
     SetHSV(ColorHandler.RGBtoHSV(RGB));
     SetRGBLabels(RGB);
     this.ColorTab.Invalidate();
 }
 private void UpdateCancelButton(ColorHandler.RGB RGB)
 {
     btnCancel.BackColor = ColorHandler.RGBtoColor(RGB);
     btnCancel.ForeColor = (RGB.Red < 180 && RGB.Green < 180) ? Color.White : Color.Black;
 }
Beispiel #30
0
 private void SetRGBLabels(ColorHandler.RGB RGB)
 {
     RefreshText(lblRed, RGB.Red);
     RefreshText(lblBlue, RGB.Blue);
     RefreshText(lblGreen, RGB.Green);
 }