Esempio n. 1
0
 public void Draw(Graphics g, ColorManagerWheel.RGB RGB)
 {
     // Given RGB values, calculate HSV and then update the screen.
     this.g   = g;
     this.HSV = ColorManagerWheel.RGBtoHSV(RGB);
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
        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 ColorManagerWheel.RGB((int)nudRed.Value, (int)nudGreen.Value, (int)nudBlue.Value);
                SetHSV(ColorManagerWheel.RGBtoHSV(RGB));
                this.Invalidate();

                ColorUIEditorPaletteCtrl.ColorPickEventArgs rgs = new ColorUIEditorPaletteCtrl.ColorPickEventArgs();
                rgs.Color = Color.FromArgb(RGB.Red, RGB.Green, RGB.Blue);

                if (ColorChanged != null)
                {
                    ColorChanged(Color.FromArgb(RGB.Red, RGB.Green, RGB.Blue), rgs);
                }
            }
        }