怎样自定义DevExpress XtraTreeList的单元格样式
展开全部
通过TreeList.NodeCellStyle事件,可以对单元格外观进行自定义
关键代码:
private void treeList1_NodeCellStyle(object sender, DevExpress.XtraTreeList.GetCustomNodeCellStyleEventArgs e)
{
if (e.Column.FieldName != "BUDGET") return;
if (Convert.ToInt32(e.Node.GetValue(e.Column.AbsoluteIndex)) > 500000)
{
e.Appearance.BackColor = Color.FromArgb(80, 255, 0, 255);
e.Appearance.ForeColor = Color.White;
e.Appearance.Font = new Font(e.Appearance.Font, FontStyle.Bold);
}
}
关键代码:
private void treeList1_NodeCellStyle(object sender, DevExpress.XtraTreeList.GetCustomNodeCellStyleEventArgs e)
{
if (e.Column.FieldName != "BUDGET") return;
if (Convert.ToInt32(e.Node.GetValue(e.Column.AbsoluteIndex)) > 500000)
{
e.Appearance.BackColor = Color.FromArgb(80, 255, 0, 255);
e.Appearance.ForeColor = Color.White;
e.Appearance.Font = new Font(e.Appearance.Font, FontStyle.Bold);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询