devexpress xtragrid.gridcontrol根据单元格内容设定该行颜色
当执行以下代码时,只有一个单元格变色了(fieldname”PROGRAMID“等于”ABC“),如何可以让该单元格所在行全部变色?在线急等,多谢!!publicvoid...
当执行以下代码时,只有一个单元格变色了(fieldname”PROGRAMID“ 等于”ABC“) ,如何可以让该单元格所在行全部变色?在线急等,多谢!!
public void gvSequence_RowCellStyle(object sender, RowCellStyleEventArgs e)
{
GridView MotherGridview = sender as GridView;
if (e.Column.FieldName == “PROGRAMID“)
{
if (MotherGridview.GetRowCellDisplayText(e.RowHandle, e.Column) == "ABC")
{
e.Appearance.BackColor = Color.Yellow;
e.Appearance.BackColor2 = Color.LightCyan;
}
}
}
} 展开
public void gvSequence_RowCellStyle(object sender, RowCellStyleEventArgs e)
{
GridView MotherGridview = sender as GridView;
if (e.Column.FieldName == “PROGRAMID“)
{
if (MotherGridview.GetRowCellDisplayText(e.RowHandle, e.Column) == "ABC")
{
e.Appearance.BackColor = Color.Yellow;
e.Appearance.BackColor2 = Color.LightCyan;
}
}
}
} 展开
展开全部
private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
if (e.RowHandle >= 0)
{
SaleDataImportModel data = (SaleDataImportModel)gridView1.GetRow(e.RowHandle);
switch (data.ProductMappingStatus)
{
case 0:
e.Appearance.BackColor = Color.LightGreen;
break;
case 1:
e.Appearance.BackColor = Color.LightYellow;
break;
case 2:
e.Appearance.BackColor = Color.LightPink;
break;
}
}
}
你用错误事件了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询