Exemplo n.º 1
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.º 2
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.º 3
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle)
 {
     Color     = color;
     DrawStyle = drawStyle;
 }
Exemplo n.º 4
0
 public override void GetSliderColor(Point lastPos, MyColor selectedColor, int ClientWidth, int ClientHeight)
 {
     selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (ClientHeight - 1);
     selectedColor.HSBUpdate();
 }
Exemplo n.º 5
0
 public ColorEventArgs(MyColor color, ColorType colorType)
 {
     Color     = color;
     ColorType = colorType;
 }
Exemplo n.º 6
0
 public override void SetSliderMarker(Point lastPos, MyColor SelectedColor, int ClientHeight)
 {
     lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * SelectedColor.HSB.Brightness);
 }
Exemplo n.º 7
0
 public override void GetBoxColor(Point lastPos, MyColor selectedColor, int ClientWidth, int ClientHeight)
 {
     selectedColor.HSB.Hue        = (double)lastPos.X / (ClientWidth - 1);
     selectedColor.HSB.Saturation = 1.0 - (double)lastPos.Y / (ClientHeight - 1);
     selectedColor.HSBUpdate();
 }
Exemplo n.º 8
0
 public override void GetBoxColor(Point lastPos, MyColor selectedColor, int ClientWidth, int ClientHeight)
 {
     selectedColor.RGBA.Blue  = Round(255 * (double)lastPos.X / (ClientWidth - 1));
     selectedColor.RGBA.Green = Round(255 * (1.0 - (double)lastPos.Y / (ClientHeight - 1)));
     selectedColor.RGBAUpdate();
 }
Exemplo n.º 9
0
 public override void SetBoxMarker(Point lastPos, MyColor SelectedColor, int ClientWidth, int ClientHeight)
 {
     lastPos.X = Round((ClientWidth - 1) * (double)SelectedColor.RGBA.Blue / 255);
     lastPos.Y = Round((ClientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Green / 255));
 }
Exemplo n.º 10
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.º 11
0
 public void ChangeColor(Color color, ColorType colorType = ColorType.None)
 {
     SelectedColor = color;
     OnColorChanged(colorType);
 }
Exemplo n.º 12
0
 public abstract void GetSliderColor(Point lastPos, MyColor selectedColor, int ClientWidth, int ClientHeight);
Exemplo n.º 13
0
 private void colorBox_ColorChanged(object sender, ColorEventArgs e)
 {
     selectedColor             = e.Color;
     colorSlider.SelectedColor = SelectedColor;
     OnColorChanged();
 }
Exemplo n.º 14
0
 public abstract void SetSliderMarker(Point lastPos, MyColor SelectedColor, int ClientHeight);
Exemplo n.º 15
0
 public abstract void SetBoxMarker(Point lastPos, MyColor SelectedColor, int ClientWidth, int ClientHeight);
Exemplo n.º 16
0
 public override void GetSliderColor(Point lastPos, MyColor selectedColor, int ClientWidth, int ClientHeight)
 {
     selectedColor.RGBA.Red = 255 - Round(255 * (double)lastPos.Y / (ClientHeight - 1));
     selectedColor.RGBAUpdate();
 }
Exemplo n.º 17
0
 public ColorEventArgs(MyColor color, ColorType colorType)
 {
     Color = color;
     ColorType = colorType;
 }
Exemplo n.º 18
0
 private void colorPicker_ColorChanged(object sender, ColorEventArgs e)
 {
     NewColor = e.Color;
     UpdateControls(NewColor, e.ColorType);
 }
Exemplo n.º 19
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle)
 {
     Color = color;
     DrawStyle = drawStyle;
 }
Exemplo n.º 20
0
 public override void SetSliderMarker(Point lastPos, MyColor SelectedColor, int ClientHeight)
 {
     lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * (double)SelectedColor.RGBA.Red / 255);
 }
Exemplo n.º 21
0
 private void colorSlider_ColorChanged(object sender, ColorEventArgs e)
 {
     selectedColor = e.Color;
     colorBox.SelectedColor = SelectedColor;
     OnColorChanged();
 }
Exemplo n.º 22
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.º 23
0
 public override void SetBoxMarker(Point lastPos, MyColor SelectedColor, int ClientWidth, int ClientHeight)
 {
     lastPos.X = Round((ClientWidth - 1) * SelectedColor.HSB.Hue);
     lastPos.Y = Round((ClientHeight - 1) * (1.0 - SelectedColor.HSB.Saturation));
 }
Exemplo n.º 24
0
 private void colorPicker_ColorChanged(object sender, ColorEventArgs e)
 {
     NewColor = e.Color;
     UpdateControls(NewColor, e.ColorType);
 }