c# - 如何更改具体 TreeListNode 的字体?

标签 c# winforms devexpress xtratreelist

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

对于标准的 TreeView 节点,有 Font 属性。

最佳答案

查看 DevExpress 文档

XtraTreeList NodeCellStyle Event

How to: Customize the appearance of individual cells

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);
  }
}

关于c# - 如何更改具体 TreeListNode 的字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5581086/

相关文章:

c# - 如何将给定数组中的数字随机返回到标签中

c# - 如何在 SqlDataSource select Command where 条件中传递属性值?

c# - DevExpress 中的 RibbonRadioButton 相当于什么?

c# 数据从数据网格到文本框?

c# - 使用 LINQ 连接两个不同类型的列表

c# - 将事件写入事件日志期间出现 WCF 异常

C# ListView 与组一起显示为空白

C# Windows 窗体 - 在控件外部单击后隐藏控件

c# - 更改 XtraGrid 中的数据源

asp.net - firefox 和 opera 不兼容的浏览器