4

我需要更改 XtraTreeList 中 TreeListNode 项的字体

对于标准 TreeViewNode 有 Font 属性。

4

2 回答 2

6

查看 DevExpress 文档

XtraTreeList NodeCellStyle 事件

如何:自定义单个单元格的外观

using DevExpress.XtraTreeList;

private void treeList1_NodeCellStyle(object sender, GetCustomNodeCellStyleEventArgs e)
{
  // Modifying the appearance settings used to paint the "Budget" column's cells
  // whose values are greater than 500,000 .
  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);
  }
}
于 2011-04-07T12:39:54.920 回答
-1

或者您可以使用事件 TreeList.CustomDrawNodeCell。

于 2011-04-07T12:44:24.940 回答