private void dgvLog_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == RowID.Index && e.Value != null) { e.Value = e.Value.ToString().ToUpper(); } else if (e.ColumnIndex == ProcessStatus.Index && e.Value != null) { LogTable.ProcessStatusEnum processStatus = (LogTable.ProcessStatusEnum)e.Value; e.Value = LogTable.StatusDesc(processStatus); switch (processStatus) { case LogTable.ProcessStatusEnum.EndWarning: e.CellStyle.ForeColor = Color.Black; e.CellStyle.BackColor = Color.Yellow; break; case LogTable.ProcessStatusEnum.EndError: e.CellStyle.ForeColor = Color.White; e.CellStyle.BackColor = Color.Red; break; case LogTable.ProcessStatusEnum.EndFail: e.CellStyle.ForeColor = Color.White; e.CellStyle.BackColor = Color.DarkRed; break; default: e.CellStyle.ForeColor = Color.Black; e.CellStyle.BackColor = Color.White; break; } } }