Пример #1
0
        public override string ToString()
        {
            return(string.Format(
                       @"RGBA (Red, Green, Blue, Alpha) = {0}, {1}, {2}, {3}
HSB (Hue, Saturation, Brightness) = {4:0.0}°, {5:0.0}%, {6:0.0}%
CMYK (Cyan, Magenta, Yellow, Key) = {7:0.0}%, {8:0.0}%, {9:0.0}%, {10:0.0}%
Hex (RGB, RGBA, ARGB) = #{11}, #{12}, #{13}
Decimal (RGB, RGBA, ARGB) = {14}, {15}, {16}",
                       RGBA.Red, RGBA.Green, RGBA.Blue, RGBA.Alpha,
                       HSB.Hue360, HSB.Saturation100, HSB.Brightness100,
                       CMYK.Cyan100, CMYK.Magenta100, CMYK.Yellow100, CMYK.Key100,
                       ColorHelpers.ColorToHex(this), ColorHelpers.ColorToHex(this, ColorFormat.RGBA), ColorHelpers.ColorToHex(this, ColorFormat.ARGB),
                       ColorHelpers.ColorToDecimal(this), ColorHelpers.ColorToDecimal(this, ColorFormat.RGBA), ColorHelpers.ColorToDecimal(this, ColorFormat.ARGB)));
        }
Пример #2
0
        private void UpdateControls(MyColor color, ColorType type)
        {
            DrawPreviewColors();
            controlChangingColor = true;

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

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

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

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

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

            Color knownColor = ColorHelpers.FindClosestKnownColor(color);

            lblNameValue.Text = Helpers.GetProperName(knownColor.Name);

            controlChangingColor = false;
        }
Пример #3
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;
        }
Пример #4
0
 public int ToDecimal(ColorFormat format = ColorFormat.RGB)
 {
     return(ColorHelpers.ColorToDecimal(this, format));
 }
Пример #5
0
        private void tsmiCopyDecimal_Click(object sender, EventArgs e)
        {
            int dec = ColorHelpers.ColorToDecimal(colorPicker.SelectedColor, ColorFormat.RGB);

            ClipboardHelpers.CopyText(dec.ToString());
        }