private void GridResults_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) return; RowResults tuple = (RowResults)GridResults.Rows[e.RowIndex].DataBoundItem; ImageForm frm; if (GridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.GetType().Equals(typeof(Image)) || GridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.GetType().Equals(typeof(Bitmap)) ) { frm = new ImageForm((Image)GridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); frm.MdiParent = MdiParent; frm.Show(); } else { switch (e.ColumnIndex) { case 3: MeasuresViewerForm m = new MeasuresViewerForm(tuple.Item4); m.MdiParent = MdiParent; m.Show(); break; } } }
private void gridResults_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0 || e.ColumnIndex < 0) return; RowResults tuple = (RowResults)gridResults.Rows[e.RowIndex].DataBoundItem; ImageForm frm; if (gridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.GetType().Equals(typeof(Image)) || gridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.GetType().Equals(typeof(Bitmap))) { frm = new ImageForm((Image)(gridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)); frm.MdiParent = MdiParent; frm.Show(); } else if (gridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.GetType().Equals(typeof(WeakImage))) { frm = new ImageForm(((WeakImage)gridResults.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).Image); frm.MdiParent = MdiParent; frm.Show(); } else { switch (e.ColumnIndex) { case 3: MeasuresViewerForm m = new MeasuresViewerForm(tuple.Item4); m.MdiParent = MdiParent; m.Show(); break; } } } catch (Exception ex) { MessageBox.Show(ex.GetType().FullName, ex.Message); } }