public Color GetColor(int x, int y) { var color = VideoCapture.GetColor(x, y); SampleImage = null; // update controls form.checkBoxGraphicSampling.Checked = false; PictureBoxShow(color); form.textBoxGraphicX.Text = x.ToString(); form.textBoxGraphicY.Text = y.ToString(); form.textBoxGraphicWidth.Text = string.Empty; form.textBoxGraphicHeight.Text = string.Empty; form.textBoxGraphicColorR.Text = color.R.ToString(); form.textBoxGraphicColorG.Text = color.G.ToString(); form.textBoxGraphicColorB.Text = color.B.ToString(); form.textBoxGraphicWebColor.Text = $"#{color.R:X2}{color.G:X2}{color.B:X2}"; form.textBoxGraphicCode.Text = GenerateCode(x, y, color); return(color); }