private void OnGridCellDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } if (this.m_Grid.Columns[e.ColumnIndex].Name == Strings.DATASHEET_COLOR_COLUMN_NAME) { ColorColumns.AssignGridViewColor(this.m_Grid, e.RowIndex, e.ColumnIndex); } }
private void OnGridKeyDown(object sender, KeyEventArgs e) { if (this.m_Grid.Columns[this.m_Grid.CurrentCell.ColumnIndex].Name == Strings.DATASHEET_COLOR_COLUMN_NAME) { if (e.KeyCode == Keys.Delete) { this.m_Grid.BeginEdit(false); this.m_Grid.CurrentCell.Value = null; this.m_Grid.EndEdit(); e.Handled = true; } else if (e.KeyCode == Keys.Enter) { ColorColumns.AssignGridViewColor( this.m_Grid, this.m_Grid.CurrentCell.RowIndex, this.m_Grid.CurrentCell.ColumnIndex); e.Handled = true; } } }