1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| // ***********************************************************************************
private void dgvResult_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex < 0 || e.RowIndex >= dgvResult.RowCount)
{
return;
}
int col = e.ColumnIndex;
if (col != 0) return;
if (dgvResult.Rows[e.RowIndex].Cells[col].Value.ToString().Equals(string.Empty))
{
dgvResult.Rows[e.RowIndex].Cells[col].Style.BackColor = Color.Gold;
return;
}
// dgvKeys.Rows[0].Cells[col].Style.BackColor = Color.Gold;
}
// ***********************************************************************************
private void dgvResult_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
if (!rdbtnCommandes.Checked)
{
return;
}
DataGridViewRow theRow = (DataGridViewRow)dgvResult.Rows[e.RowIndex];
Object TP = theRow.Cells["TP"].Value;
if (TP != DBNull.Value)
{
if (TP.ToString().Equals("CE"))
{
theRow.DefaultCellStyle.BackColor = Color.Gold;
}
return;
}
} |
Partager