private void ColorBut_Click(object sender, EventArgs e) { try { // get the color at the Find point Point ReferencePoint = GetReferencePoint(); Point p = new Point(ReferencePoint.X + Int32.Parse(XFind.Text), ReferencePoint.Y + Int32.Parse(YFind.Text)); Color pix = screen_capturer.GetColorOfPx(p); // display color to the user ColorBox.Text = pix.Name.Substring(2); ColorPic.BackColor = pix; } catch (FormatException) { MessageBox.Show("Enter in pixel coordinates in the boxes above first."); } }