private void TdgRequerimientos_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { //darle el color a al celda segun su prioridad switch (e.Column.DataColumn.DataField) { case "PrioridadID": if (this.TdgRequerimientos[e.Row, "PrioridadID"].ToString().Trim() == "M") { e.CellStyle.BackColor = Color.Gold; e.CellStyle.ForeColor = Color.Black; break; } if (this.TdgRequerimientos[e.Row, "PrioridadID"].ToString().Trim() == "B") { e.CellStyle.BackColor = Color.MediumSeaGreen; break; } if (this.TdgRequerimientos[e.Row, "PrioridadID"].ToString().Trim() == "A") { e.CellStyle.BackColor = Color.Crimson; break; } break; } }
private void tdbgdetalle_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { asignacion = Convert.ToBoolean(tdbgdetalle.Columns["Asignacion"].CellText(e.Row)); if (asignacion == true) { e.CellStyle.Locked = true; } else { e.CellStyle.Locked = false; } }
private void TdgReservas_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { //habilitar si se puede modificar la columna de descpachar switch (e.Column.DataColumn.DataField) { case "Despachar": if (this.TdgReservas[e.Row, "EstadoID"].ToString().Trim() == "5") //atendido y recepcion parcial { e.CellStyle.Locked = true; break; } break; } }
// color the link properly private void c1TrueDBGrid1_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { Hyperlink link = this.c1TrueDBGrid1[e.Row, "Link"] as Hyperlink; if (link != null) { e.CellStyle.Font = new Font(this.c1TrueDBGrid1.Font, FontStyle.Underline); if (link.Visited) { e.CellStyle.ForeColor = Color.Purple; } else { e.CellStyle.ForeColor = Color.Blue; } } }
private void c1TdgAlmacen_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { switch (e.Col) { case 12: S = int.Parse(c1TdgAlmacen.Columns["Prioridad"].CellText(e.Row)); if (S >= 0 && S <= 2) { e.CellStyle.BackColor = System.Drawing.Color.Red; } else if (S > 2 && S <= 4) { e.CellStyle.BackColor = System.Drawing.Color.Yellow; } else { e.CellStyle.BackColor = System.Drawing.Color.Green; } break; } }
private void TdgEmpresa_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { switch (e.Col) { case 5: if (this.TdgEmpresa[e.Row, 5] != DBNull.Value) { //e.CellStyle.BackgroundImage = (Image)this.TdgEmpresa[e.Row, 5]; // El campo productImage primero se almacena en un buffer DataRow[] customerRow = DTEmpresas.Select("EmpresaID = '" + this.TdgEmpresa[e.Row, 0] + "'"); if (customerRow[0]["Logo"] != DBNull.Value) { byte[] imageBuffer = (byte[])customerRow[0]["Logo"]; // Se crea un MemoryStream a partir de ese buffer System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBuffer); // Se utiliza el MemoryStream para extraer la imagen e.CellStyle.BackgroundImage = Image.FromStream(ms); } } break; } }
private void tdbg_liste_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { try { string S = ""; if (e.Column.Name == "Changement") { S = "";// this.tdbg_liste[e.Row, "Changement"].ToString(); if (S.Contains("Augmentation")) { e.CellStyle.ForeColor = System.Drawing.Color.Green; } if (S.Contains("Diminution")) { e.CellStyle.ForeColor = System.Drawing.Color.Red; } } } catch (Exception er) { MessageBox.Show(er.Message); } }
private void tdgbPeso_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e) { switch (e.Col) { case 1: string p1 = tdgbPeso.Columns["Peso1"].CellText(e.Row); if (p1 == "") { e.CellStyle.Locked = true; } else if (p1 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p1) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 2: string p2 = tdgbPeso.Columns["Peso2"].CellText(e.Row); if (p2 == "") { e.CellStyle.Locked = true; } else if (p2 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p2) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 3: string p3 = tdgbPeso.Columns["Peso3"].CellText(e.Row); if (p3 == "") { e.CellStyle.Locked = true; } else if (p3 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p3) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 4: string p4 = tdgbPeso.Columns["Peso4"].CellText(e.Row); if (p4 == "") { e.CellStyle.Locked = true; } else if (p4 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p4) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 5: string p5 = tdgbPeso.Columns["Peso5"].CellText(e.Row); if (p5 == "") { e.CellStyle.Locked = true; } else if (p5 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p5) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 6: string p6 = tdgbPeso.Columns["Peso6"].CellText(e.Row); if (p6 == "") { e.CellStyle.Locked = true; } else if (p6 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p6) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 7: string p7 = tdgbPeso.Columns["Peso7"].CellText(e.Row); if (p7 == "") { e.CellStyle.Locked = true; } else if (p7 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p7) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 8: string p8 = tdgbPeso.Columns["Peso8"].CellText(e.Row); if (p8 == "") { e.CellStyle.Locked = true; } else if (p8 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p8) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 9: string p9 = tdgbPeso.Columns["Peso9"].CellText(e.Row); if (p9 == "") { e.CellStyle.Locked = true; } else if (p9 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p9) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; case 10: string p10 = tdgbPeso.Columns["Peso10"].CellText(e.Row); if (p10 == "") { e.CellStyle.Locked = true; } else if (p10 == "0") { e.CellStyle.BackColor = Color.LimeGreen; } else if (Convert.ToDecimal(p10) < pesoMinimo) { e.CellStyle.BackColor = Color.LightCoral; } else { e.CellStyle.Locked = false; } break; } }