【问题标题】:How to change font for concrete TreeListNode?如何更改具体 TreeListNode 的字体?
【发布时间】:2011-07-31 15:59:06
【问题描述】:

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

对于标准 TreeViewNode 有 Font 属性。

【问题讨论】:

    标签: c# winforms devexpress xtratreelist


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 2017-09-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多