如何让DevExpress TreeList的每个结点高亮显示
推荐于2017-10-02 · 知道合伙人数码行家
知道合伙人数码行家
向TA提问 私信TA
代码如下:
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);
Rectangle r = 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;
}
}
2023-05-10 广告