public Bitmap GetImage(int x, int y, int w, int h) { var img = VideoCapture.GetImage(x, y, w, h); SampleImage = img; // update controls form.checkBoxGraphicSampling.Checked = false; PictureBoxShow(img); form.textBoxGraphicX.Text = x.ToString(); form.textBoxGraphicY.Text = y.ToString(); form.textBoxGraphicWidth.Text = w.ToString(); form.textBoxGraphicHeight.Text = h.ToString(); form.textBoxGraphicColorR.Text = string.Empty; form.textBoxGraphicColorG.Text = string.Empty; form.textBoxGraphicColorB.Text = string.Empty; form.textBoxGraphicWebColor.Text = string.Empty; form.textBoxGraphicCode.Text = GenerateCode(x, y, form.comboBoxGraphicFilename.Text); return(img); }