private void btnOK_Click(object sender, EventArgs e) { if (cmbFirstImage.SelectedItem != null && cmbSecondImage.SelectedItem != null) { Bitmap bmp1 = bitmaps[(string)cmbFirstImage.SelectedItem]; Bitmap bmp2 = new Bitmap((Bitmap)bitmaps[(string)cmbSecondImage.SelectedItem], bmp1.Width, bmp1.Height);//(Bitmap)bitmaps[(string)cmbSecondImage.SelectedItem].Clone(); //resultBmp = (Bitmap)bmp1.Clone(); operationOnImage = new BasicImageOpertions(bmp2); operationOnImage.ToGreyScale(); operationOnImage = new BasicImageOpertions(bmp1); if (rdbAdd.Checked) { operationOnImage.ADD(bmp2); } else if (rdbSub.Checked) { operationOnImage.SUB(bmp2); } else if (rdbDiff.Checked) { operationOnImage.DIFF(bmp2); } else if (rdbOR.Checked) { operationOnImage.OR(bmp2); } else if (rdbAND.Checked) { operationOnImage.AND(bmp2); } else if (rdbXOR.Checked) { operationOnImage.XOR(bmp2); } //else if (radioButtonAnd.Checked) And(bmp1, bmp2); //else if (radioButtonOr.Checked) Or(bmp1, bmp2); //else if (radioButtonXor.Checked) Xor(bmp1, bmp2); } foreach (Image_Panel form in forms) { form.Refresh(); form.RemakeHistogram(); } this.Close(); }