如何让DevExpress TreeList的每个结点高亮显示?
概述:如何让DevExpress TreeList的每个节点高亮显示?
如何让DXperience TreeList的每个节点高亮显示?
效果如下:
private void treeList1_CustomDrawNodeCell(object sender, DevExpress.XtraTreeList.CustomDrawNodeCellEventArgs e)
{
TreeList node = sender as TreeList;
if(e.Node == node.FocusedNode)
{
e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
Rectangler = new Rectangle(e.EditViewInfo.ContentRect.Left,
e.EditViewInfo.ContentRect.Top,
Convert.ToInt32(e.Graphics.MeasureString(e.CellText,treeList1.Font).Width + 1),
Convert.ToInt32(e.Graphics.MeasureString(e.CellText,treeList1.Font).Height));
e.Graphics.FillRectangle(SystemBrushes.Highlight, r);
e.Graphics.DrawString(e.CellText, treeList1.Font, SystemBrushes.HighlightText, r);
e.Handled = true;
}
}