private void DGV_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { try { DGV.PerformLayout(); if (DGV.InvokeRequired) { DGV.Invoke(new On_DataPaintdDelegate(DGV_RowPrePaint), sender, e); return; } if (Convert.ToString(DGV.Rows[e.RowIndex].Cells["Symbol"].Value) == "Total") { // DGV.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red; DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red; } } catch (Exception ex) { } }
private void DGV_RowPrePaint_1(object sender, DataGridViewRowPrePaintEventArgs e) { try { DGV.PerformLayout(); if (DGV.InvokeRequired) { DGV.Invoke(new On_DataPaintdDelegate(DGV_RowPrePaint_1), sender, e); return; } if (Convert.ToDouble(DGV.Rows[e.RowIndex].Cells["ACTUALPRICE"].Value) < 0) { // DGV.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red; DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Blue; } else { DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red; } } catch (Exception ex) { } }