1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| private void dataGridTestBandDefinition_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dataGridTestBandDefinition.Columns.Count - 1)
{
dataGridTestBandDefinition.Rows.Remove(dataGridTestBandDefinition.Rows[e.RowIndex]);
}
if (e.ColumnIndex == dataGridTestBandDefinition.Columns.Count - 2)
{
DialogResult result = this.colorDialog1.ShowDialog();
if (result.Equals(DialogResult.OK))
{
// Create a new cell style.
DataGridViewCellStyle style = new DataGridViewCellStyle();
{
style.BackColor = this.colorDialog1.Color;
style.ForeColor = this.colorDialog1.Color;
}
// Apply the style as the default cell style.
dataGridTestBandDefinition.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = style;
}
}
} |
Partager