![](/img/trans.png)
[英]How can I change the font color of a TextRange in PowerPoint from C#?
[英]How can I change font color in gridview DevExpress c#
如何更改DevExpress網格視圖的字體顏色? 我發現的所有解決方案都是關於改變前景色和背景色。
我希望有一個紅色字體,以防單元格中的值為負。
有什么建議嗎?
簽署RowCellStyle事件並在那里設置ForeColor
private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
if(e.Column.FieldName == "Field2")
{
var data = gridView1.GetRow(e.RowHandle) as Sample;
if(data == null)
return;
if (data.Field2 < 0)
e.Appearance.ForeColor = Color.Red;
}
}
您想要查看條件格式規則。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.