private void histogramToolStripMenuItem_Click(object sender, EventArgs e) { try { if (this.ActiveMdiChild != null && this.ActiveMdiChild is ImageBox) { ((PictureForm)this.ActiveMdiChild).histogram(); } else { if (this.histogram_form == null) { this.histogram_form = new HistogramForm(); this.histogram_form.MdiParent = this; this.histogram_form.Text = "Histogram"; this.histogram_form.Show(); } } if (this.histogram_form != null) { this.histogram_form.Activate(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }