private void textBoxK_TextChanged(object sender, EventArgs e) { if (textBoxK.Text.Length > 0) { if (float.Parse(textBoxK.Text) > 1) { textBoxK.Text = "1"; } if (float.Parse(textBoxK.Text) < 0) { textBoxK.Text = "0"; } Cmyk cmykColor = new Cmyk(); cmykColor.C = float.Parse(textBoxC.Text); cmykColor.M = float.Parse(textBoxM.Text); cmykColor.Y = float.Parse(textBoxY.Text); cmykColor.K = float.Parse(textBoxK.Text); ColorPhraser switcher = new ColorPhraser(); Color color = switcher.SwitchCmykToRgb(cmykColor); textBoxR.Text = color.R.ToString(); textBoxG.Text = color.G.ToString(); textBoxB.Text = color.B.ToString(); draw(color); } }
private void textBoxR_TextChanged(object sender, EventArgs e) { if (textBoxR.Text.Length > 0) { if (int.Parse(textBoxR.Text) > 255) { textBoxR.Text = "255"; } if (int.Parse(textBoxR.Text) < 0) { textBoxR.Text = "0"; } Color color = Color.FromArgb(int.Parse(textBoxR.Text), int.Parse(textBoxG.Text), int.Parse(textBoxB.Text)); ColorPhraser switcher = new ColorPhraser(); Cmyk cmykColor = switcher.SwitchRgbToCmyk(color); textBoxC.Text = cmykColor.C.ToString(); textBoxM.Text = cmykColor.M.ToString(); textBoxY.Text = cmykColor.Y.ToString(); textBoxK.Text = cmykColor.K.ToString(); draw(color); } }