[C#] 纯文本查看 复制代码 //在绘制节点时设置点击后的背景色及选中宽度
private void BlankTreeList_CustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e)
{
TreeList tree = sender as TreeList;
if (e.Node == tree.FocusedNode)
{
e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
Rectangle rect = new Rectangle(e.EditViewInfo.ContentRect.Left,
e.EditViewInfo.ContentRect.Top,
Convert.ToInt32(e.Graphics.MeasureString(e.CellText, BlankTreeList.Font).Width + 1),
Convert.ToInt32(e.Graphics.MeasureString(e.CellText, BlankTreeList.Font).Height + 1));
e.Graphics.FillRectangle(SystemBrushes.Highlight, rect);
e.Graphics.DrawString(e.CellText, BlankTreeList.Font, SystemBrushes.HighlightText, rect);
e.Handled = true;
}
}
|