Как изменить шрифт для конкретного TreeListNode? - PullRequest
4 голосов
/ 07 апреля 2011

Мне нужно изменить шрифт для элемента TreeListNode в XtraTreeList

Для стандартного TreeViewNode есть свойство Font.

Ответы [ 2 ]

6 голосов
/ 07 апреля 2011

Оформление документации 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);
  }
}
0 голосов
/ 07 апреля 2011

Или вы можете использовать событие TreeList.CustomDrawNodeCell.

...