private void Ebox_FormClosed(object sender, FormClosedEventArgs e) { FormMiniEntityBox ebox = (FormMiniEntityBox)sender; DataGridViewCell dataGridViewCell = (DataGridViewCell)ebox.custom; dataGridViewCell.Value = SerializeEntities(ebox.root); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { int column = e.ColumnIndex; int row = e.RowIndex; if (ShowMode) { return; } switch (e.ColumnIndex) { // Load image case 2: DataGridViewImageCell imageCell = (DataGridViewImageCell) dataGridView1.Rows[row].Cells[column]; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string path = openFileDialog1.FileName; imageCell.Value = Image.FromFile(path); } break; // Edit feature entities case 3: DataGridViewCell dataGridViewCell = (DataGridViewCell)dataGridView1.Rows[row].Cells[column]; FormMiniEntityBox ebox = new FormMiniEntityBox(dataGridViewCell, UnserializeEntities((string)dataGridViewCell.Value)); ebox.FormClosed += Ebox_FormClosed; ebox.ShowDialog(); break; } }