private void OpenToolStripMenuItem_Click(object sender, EventArgs e) { if (ImageFileDialog.ShowDialog() == DialogResult.OK) { try { var bmp = _processor.ConvertToGrayscale(new Bitmap(ImageFileDialog.FileName)); _image.OriginalImage = bmp; _image.ViewImage = bmp; pictureBox1.BorderStyle = BorderStyle.FixedSingle; EnableMenuBarToolstrips(); isBinarized = false; } catch (ArgumentException ex) { var extension = ImageFileDialog.FileName.Split('.'); MessageBox.Show($"Could not open file with .{extension[extension.Length - 1]} format", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }