效果如下:
代码如下:
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;
}
}
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/178.html