private void button3_Click(object sender, EventArgs e) { SetLabelVisibel(10, false); SetLabelVisibel(11, false); SetLabelVisibel(12, false); SetPictureBoxVisibel(2, false); SetPictureBoxVisibel(3, false); SetPictureBoxVisibel(4, false); SetChartVisibel(1, false); SetChartVisibel(2, false); if (openImg != null) { Grayscale trans = new Grayscale(); Bitmap grayImg = new Bitmap(openImg); // transform image to grayscale grayImg = trans.Transform(openImg); if (grayImg != null) { SetLabel(10, "Grayscale"); SetPictureBox(2, grayImg); SetLabelVisibel(10, true); SetPictureBoxVisibel(2, true); } else { SetLabelVisibel(10, false); SetPictureBoxVisibel(2, false); } } }