Example #1
0
        private void Button_xyzParaRgb_Click(object sender, EventArgs e)
        {
            ConversorEntreEspacos converte = new ConversorEntreEspacos();

            LimpaExceto("xyz");
            String xAux = textBox_X.Text;
            String yAux = textBox_Y.Text;
            String zAux = textBox_Z.Text;

            if ((xAux.Trim() != "") && (yAux.Trim() != "") && (zAux.Trim() != ""))
            {
                double x = Convert.ToDouble(xAux);
                double y = Convert.ToDouble(yAux);
                double z = Convert.ToDouble(zAux);
                converte.XyzParaRgb(x, y, z);

                textBox_vermelho.Text = Convert.ToString(converte.GetR());
                textBox_verde.Text    = Convert.ToString(converte.GetG());
                textBox_azul.Text     = Convert.ToString(converte.GetB());
            }
            else
            {
                MessageBox.Show("Preecha todos os campos de XYZ", "XYZ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void Button_rgbParaTodos_Click(object sender, EventArgs e)
        {
            LimpaExceto("rgb");
            ConversorEntreEspacos converte = new ConversorEntreEspacos();
            String re = textBox_vermelho.Text;
            String gr = textBox_verde.Text;
            String bl = textBox_azul.Text;

            if ((re.Trim() != "") && (gr.Trim() != "") && (bl.Trim() != ""))
            {
                double r = Convert.ToDouble(re);
                double g = Convert.ToDouble(gr);
                double b = Convert.ToDouble(bl);
                converte.RgbParaXyz(r, g, b);
                converte.RgbParaCinzaMedia(r, g, b);
                converte.RgbParaCinzaCoeficiente(r, g, b);
                converte.RgbParaCmyk(r, g, b);
                converte.RgbParaHsv(r, g, b);

                textBox_X.Text = Convert.ToString(converte.GetX_yz());
                textBox_Y.Text = Convert.ToString(converte.GetY_xyz());
                textBox_Z.Text = Convert.ToString(converte.GetZ_xyz());

                txt_cinzaMedia.Text = Convert.ToString(converte.GetCinzaMed());

                txt_cinzaCoef.Text = Convert.ToString(converte.GetCizaCoe());

                textBox_C_CMYK.Text = Convert.ToString(converte.GetC() + " %");
                textBox_M_cmyk.Text = Convert.ToString(converte.GetM() + " %");
                textBox_Y_cmyk.Text = Convert.ToString(converte.GetY() + " %");
                textBox_K_cmyk.Text = Convert.ToString(converte.GetK() + " %");

                textBox_H_HSV.Text = Convert.ToString(converte.GetH() + " °");
                textBox_S_HSV.Text = Convert.ToString(converte.GetS() + " %");
                textBox_V_HSV.Text = Convert.ToString(converte.GetV() + " %");
            }
            else
            {
                MessageBox.Show("Preecha todos os campos de RGB", "RGB", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }