private void TdgMacro_FetchRowStyle(object sender, FetchRowStyleEventArgs e) { Font MFont; MFont = new Font(this.TdgMicro.Font, FontStyle.Bold); //TdgMicro.CaptionStyle.Font = MFont; string S = TdgMacro.Columns["NomProducto"].CellText(e.Row).ToString(); if (S == "Totales: ") { e.CellStyle.ForeColor = System.Drawing.Color.Black; e.CellStyle.Font = MFont; } if (S == "Disponible local: ") { e.CellStyle.ForeColor = System.Drawing.Color.Blue; e.CellStyle.Font = MFont; } if (S == "Stock local: ") { e.CellStyle.ForeColor = System.Drawing.Color.Green; e.CellStyle.Font = MFont; } }
void Grid_FetchRowStyle(object sender, FetchRowStyleEventArgs e) { try { C1TrueDBGrid Grid = (C1TrueDBGrid)sender; DataTable Dt_Source = (DataTable)Grid.DataSource; if (Dt_Source.Rows.Count <= e.Row) { return; } DataRow Dr = (Grid[e.Row] as DataRowView).Row; if (Dr.RowState == DataRowState.Added) { e.CellStyle.BackColor = Color.LightYellow; } else if (Dr.RowState == DataRowState.Modified) { e.CellStyle.BackColor = Color.PaleGreen; } if (this.Ev_FetchRowStyle != null) { this.Ev_FetchRowStyle(sender, e); } } catch { } }