コード例 #1
0
        private void UpdateMixer()
        {
            int r = sliderRed.Value;
            int g = sliderGreen.Value;
            int b = sliderBlue.Value;

            System.Drawing.Color mixColor = System.Drawing.Color.FromArgb(r, g, b);
            string hex = ColorSpaceConverter.RGBToHex(r, g, b);

            if (hex.Length == 6)
            {
                lblRedHexSlider.Text   = hex.Substring(0, 2);
                lblGreenHexSlider.Text = hex.Substring(2, 2);
                lblBlueHexSlider.Text  = hex.Substring(4, 2);
            }
            else
            {
                lblRedHexSlider.Text   = "";
                lblGreenHexSlider.Text = "";
                lblBlueHexSlider.Text  = "";
            }
            lblRedSlider.Text   = r + "";
            lblGreenSlider.Text = g + "";
            lblBlueSlider.Text  = b + "";

            panMixer.BackColor = mixColor;
        }
コード例 #2
0
        private void UpdateForm()
        {
            //lblCoords.Text = "(" + x + ", " + y + ")";
            lblRed.Text   = color.R.ToString();
            lblGreen.Text = color.G.ToString();
            lblBlue.Text  = color.B.ToString();

            string hex = "#" + ColorSpaceConverter.RGBToHex(color.R, color.G, color.B);

            lblHex.Text = hex;

            lblNamedColor.Text = namedColor;
        }