Exemplo n.º 1
0
        private void UpdateControls(MyColor color, ColorType type)
        {
            DrawPreviewColors();
            controlChangingColor = true;

            if (type != ColorType.HSB)
            {
                nudHue.Value        = (decimal)Math.Round(color.HSB.Hue360);
                nudSaturation.Value = (decimal)Math.Round(color.HSB.Saturation100);
                nudBrightness.Value = (decimal)Math.Round(color.HSB.Brightness100);
            }

            if (type != ColorType.RGBA)
            {
                nudRed.Value   = color.RGBA.Red;
                nudGreen.Value = color.RGBA.Green;
                nudBlue.Value  = color.RGBA.Blue;
                nudAlpha.Value = color.RGBA.Alpha;
            }

            if (type != ColorType.CMYK)
            {
                nudCyan.Value    = (decimal)color.CMYK.Cyan100;
                nudMagenta.Value = (decimal)color.CMYK.Magenta100;
                nudYellow.Value  = (decimal)color.CMYK.Yellow100;
                nudKey.Value     = (decimal)color.CMYK.Key100;
            }

            if (type != ColorType.Hex)
            {
                txtHex.Text = ColorHelpers.ColorToHex(color);
            }

            if (type != ColorType.Decimal)
            {
                txtDecimal.Text = ColorHelpers.ColorToDecimal(color).ToString();
            }

            controlChangingColor = false;
        }
Exemplo n.º 2
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle)
 {
     Color     = color;
     DrawStyle = drawStyle;
 }
Exemplo n.º 3
0
 public void SetCurrentColor(Color currentColor)
 {
     oldColorExist = true;
     colorPicker.DrawCrosshair = lblOld.Visible = oldColorExist;
     NewColor = OldColor = currentColor;
     colorPicker.ChangeColor(currentColor);
     nudAlpha.Value = currentColor.A;
     DrawPreviewColors();
 }
Exemplo n.º 4
0
 public ColorEventArgs(MyColor color, ColorType colorType)
 {
     Color     = color;
     ColorType = colorType;
 }
Exemplo n.º 5
0
        private void UpdateControls(MyColor color, ColorType type)
        {
            DrawPreviewColors();
            controlChangingColor = true;

            if (type != ColorType.HSB)
            {
                nudHue.Value = (decimal)Math.Round(color.HSB.Hue360);
                nudSaturation.Value = (decimal)Math.Round(color.HSB.Saturation100);
                nudBrightness.Value = (decimal)Math.Round(color.HSB.Brightness100);
            }

            if (type != ColorType.RGBA)
            {
                nudRed.Value = color.RGBA.Red;
                nudGreen.Value = color.RGBA.Green;
                nudBlue.Value = color.RGBA.Blue;
                nudAlpha.Value = color.RGBA.Alpha;
            }

            if (type != ColorType.CMYK)
            {
                nudCyan.Value = (decimal)color.CMYK.Cyan100;
                nudMagenta.Value = (decimal)color.CMYK.Magenta100;
                nudYellow.Value = (decimal)color.CMYK.Yellow100;
                nudKey.Value = (decimal)color.CMYK.Key100;
            }

            if (type != ColorType.Hex)
            {
                txtHex.Text = ColorHelpers.ColorToHex(color);
            }

            if (type != ColorType.Decimal)
            {
                txtDecimal.Text = ColorHelpers.ColorToDecimal(color).ToString();
            }

            controlChangingColor = false;
        }
Exemplo n.º 6
0
        protected virtual void Initialize()
        {
            SuspendLayout();

            DoubleBuffered = true;
            ClientWidth = this.ClientRectangle.Width;
            ClientHeight = this.ClientRectangle.Height;
            bmp = new Bitmap(ClientWidth, ClientHeight, PixelFormat.Format32bppArgb);
            SelectedColor = Color.Red;
            DrawStyle = DrawStyle.Hue;

            mouseMoveTimer = new Timer();
            mouseMoveTimer.Interval = 10;
            mouseMoveTimer.Tick += new EventHandler(MouseMoveTimer_Tick);

            ClientSizeChanged += new EventHandler(EventClientSizeChanged);
            MouseDown += new MouseEventHandler(EventMouseDown);
            MouseEnter += new EventHandler(EventMouseEnter);
            MouseUp += new MouseEventHandler(EventMouseUp);
            Paint += new PaintEventHandler(EventPaint);

            ResumeLayout(false);
        }
Exemplo n.º 7
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle)
 {
     Color = color;
     DrawStyle = drawStyle;
 }
Exemplo n.º 8
0
 public ColorEventArgs(MyColor color, ColorType colorType)
 {
     Color = color;
     ColorType = colorType;
 }
Exemplo n.º 9
0
 private void colorBox_ColorChanged(object sender, ColorEventArgs e)
 {
     selectedColor             = e.Color;
     colorSlider.SelectedColor = SelectedColor;
     OnColorChanged();
 }