// Add a column public void AddHeaderColumn() { CCellHeader tCellHeader = new CCellHeader(); using (var modal = new FormDialogHeader(tCellHeader)) { modal.ShowDialog(); if (modal.DialogResult == DialogResult.OK) { _theMatrix._cellHeaderVector.AddCellHeader(tCellHeader); AddHeaderToGrid(); RefreshGrid(); } } }
// add a column private void buttonAddColumn_Click(object sender, EventArgs e) { CCellHeader tCellHeader = new CCellHeader(); using (var modal = new FormDialogHeader(tCellHeader)) { modal.ShowDialog(); if (modal.DialogResult == DialogResult.OK) { _theMatrix._cellHeaderVector.AddCellHeader(tCellHeader); AddCellToGrid(dataGridViewDyn, _theMatrix._cellHeaderVector); } else if (modal.DialogResult == DialogResult.Cancel) { } } }
// Event relay - double click on heaser // Double click on header bring the column customization window public void ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { int colIndex = e.ColumnIndex; var col = _theDataGrid.Columns[colIndex]; string colName = col.Name; CCellHeader tCellHeader = _theMatrix._cellHeaderVector.GetCellHeaderByColName(colName); using (var modal = new FormDialogHeader(tCellHeader)) { modal.ShowDialog(); if (modal.DialogResult == DialogResult.OK) { col.Name = tCellHeader._name; col.HeaderText = tCellHeader._header; } } }