// if the combo box of the gray level is changed, these method will be called private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { checkPictureBox1(); Bitmap bit = new Bitmap(pictureBox1.Image, pictureBox1.Image.Width, pictureBox1.Image.Height); pictureBox2.Refresh(); pictureBox2.Image = GraphicClass.changeGrayLevel(Convert.ToInt32(comboBox1.Text), bit); }