public void SetCurrentColor(Color currentColor)
 {
     oldColorExist = true;
     colorPicker.DrawCrosshair = lblOld.Visible = oldColorExist;
     colorPicker.Color = NewColor = OldColor = currentColor;
     DrawColors();
 }
Пример #2
0
 private void UpdateControls(MyColor color)
 {
     DrawColors();
     dialogChanged       = true;
     nudHue.Value        = (decimal)Math.Round(color.HSB.Hue360);
     nudSaturation.Value = (decimal)Math.Round(color.HSB.Saturation100);
     nudBrightness.Value = (decimal)Math.Round(color.HSB.Brightness100);
     nudRed.Value        = color.RGB.Red;
     nudGreen.Value      = color.RGB.Green;
     nudBlue.Value       = color.RGB.Blue;
     nudCyan.Value       = (decimal)Math.Round(color.CMYK.Cyan100);
     nudMagenta.Value    = (decimal)Math.Round(color.CMYK.Magenta100);
     nudYellow.Value     = (decimal)Math.Round(color.CMYK.Yellow100);
     nudKey.Value        = (decimal)Math.Round(color.CMYK.Key100);
     txtHex.Text         = MyColors.ColorToHex(color);
     txtDecimal.Text     = MyColors.ColorToDecimal(color).ToString();
     dialogChanged       = false;
 }
Пример #3
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle)
 {
     this.Color         = color;
     this.DrawStyle     = drawStyle;
     this.UpdateControl = true;
 }
Пример #4
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle, bool updateControl)
 {
     this.Color         = color;
     this.DrawStyle     = drawStyle;
     this.UpdateControl = updateControl;
 }
 private void UpdateControls(MyColor color)
 {
     DrawColors();
     dialogChanged = true;
     nudHue.Value = (decimal)Math.Round(color.HSB.Hue360);
     nudSaturation.Value = (decimal)Math.Round(color.HSB.Saturation100);
     nudBrightness.Value = (decimal)Math.Round(color.HSB.Brightness100);
     nudRed.Value = color.RGB.Red;
     nudGreen.Value = color.RGB.Green;
     nudBlue.Value = color.RGB.Blue;
     nudCyan.Value = (decimal)Math.Round(color.CMYK.Cyan100);
     nudMagenta.Value = (decimal)Math.Round(color.CMYK.Magenta100);
     nudYellow.Value = (decimal)Math.Round(color.CMYK.Yellow100);
     nudKey.Value = (decimal)Math.Round(color.CMYK.Key100);
     txtHex.Text = MyColors.ColorToHex(color);
     txtDecimal.Text = MyColors.ColorToDecimal(color).ToString();
     dialogChanged = false;
 }
 private void colorPicker_ColorChanged(object sender, ColorEventArgs e)
 {
     NewColor = e.Color;
     UpdateControls(NewColor);
 }
        protected virtual void Initialize()
        {
            this.SuspendLayout();

            this.DoubleBuffered = true;
            this.width = this.ClientRectangle.Width;
            this.height = this.ClientRectangle.Height;
            this.bmp = new Bitmap(width, height);
            this.SetColor = Color.Red;
            this.DrawStyle = DrawStyle.Hue;

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

            this.ClientSizeChanged += new System.EventHandler(this.EventClientSizeChanged);
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.EventMouseDown);
            this.MouseEnter += new EventHandler(this.EventMouseEnter);
            this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.EventMouseUp);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.EventPaint);

            this.ResumeLayout(false);
        }
Пример #8
0
 private void colorPicker_ColorChanged(object sender, ColorEventArgs e)
 {
     NewColor = e.Color;
     UpdateControls(NewColor);
 }
Пример #9
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle)
 {
     this.Color = color;
     this.DrawStyle = drawStyle;
     this.UpdateControl = true;
 }
Пример #10
0
 public ColorEventArgs(MyColor color, DrawStyle drawStyle, bool updateControl)
 {
     this.Color = color;
     this.DrawStyle = drawStyle;
     this.UpdateControl = updateControl;
 }