void SuperGridControl1GetCellStyle(object sender, GridGetCellStyleEventArgs e) { GridPanel panel = e.GridPanel; Background FondoSoles = new Background(Color.SandyBrown); Background FondoDolares = new Background(Color.SpringGreen); if (panel.Name.Equals("Table1") == true) { if (e.GridCell.GridColumn.Name.Equals("Moneda") == true) { if (((string)e.GridCell.Value).Trim().Equals("S/")) // SOLES { Fondo = FondoSoles; e.Style.Background = FondoSoles; } else { e.Style.Background = FondoDolares; Fondo = FondoDolares; } } else { e.Style.Background = Fondo; } } }
private void superGridControl1_GetCellStyle(object sender, GridGetCellStyleEventArgs e) { if (e.GridCell.GridColumn.DataPropertyName == "SampleCode") { InfEquInfSampleBarrel equInfSampleBarrel = e.GridCell.GridRow.DataItem as InfEquInfSampleBarrel; if (equInfSampleBarrel != null && !string.IsNullOrEmpty(equInfSampleBarrel.SampleCode)) { e.Style.Background.Color1 = this.dicCellColors[equInfSampleBarrel.SampleCode]; } } }
/// <summary> /// 格式化单元格颜色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void superGridControl_FormatCellColor_GetCellStyle(object sender, GridGetCellStyleEventArgs e) { if (e.GridCell.GridColumn.DataPropertyName == "TrainNumber") { View_TrainTipperQueue view_TrainTipperQueue = e.GridCell.GridRow.DataItem as View_TrainTipperQueue; if (view_TrainTipperQueue != null) { e.Style.Background.Color1 = this.dicCellColors[view_TrainTipperQueue.InFactoryBatchId + "-" + view_TrainTipperQueue.TrainSampleSchemeId]; } } }
/// <summary> /// This routine is called to retrieve application provided /// cell style information. The style being presented in this /// call is the Effective Style (style used after applying /// all base styles). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void SuperGridControl1GetCellStyle(object sender, GridGetCellStyleEventArgs e) { GridPanel panel = e.GridPanel; if (panel.Name.Equals("Customers") == true) { if (e.GridCell.GridColumn.Name.Equals("ContactTitle") == true) { if (((string)e.GridCell.Value).Equals("Owner") == true) { e.Style.TextColor = Color.Red; } } } }