private void _OnDrawNode(object sender, DrawTreeNodeEventArgs e)
{
// Node drawing.
e.Graphics.FillRectangle(e.Node.BackColor, e.Node.Bounds.X, e.Node.Bounds.Y, e.Node.Bounds.Width, e.Node.Bounds.Height);
if (e.Node.IsSelected || e.Node == _hoveredNode)
e.Graphics.FillRectangle((e.Node.IsSelected ? SelectionColor : SelectionHoverColor), UseNodeBoundsForSelection ? e.Node.Bounds.X : 0, e.Node.Bounds.Y - (int)scrollIndex, Width, ItemHeight);
bool hasImage = false;
int imageWidth = 0;
if (e.Node.ImageIndex > -1)
{
var image = ImageList.Images[e.Node.ImageIndex];
if (image != null && image.uTexture != null)
{
e.Graphics.DrawTexture(image.uTexture, e.Node.Bounds.X, e.Node.Bounds.Y + e.Node.Bounds.Height / 2 - image.Height / 2 - (int)scrollIndex, image.Width, image.Height, e.Node.ImageColor);
hasImage = true;
imageWidth = image.Width;
}
}
string stringToDraw = e.Node.Text;
if (stringToDraw == null && e.Node.Tag != null) stringToDraw = e.Node.Tag.ToString();
e.Graphics.DrawString(stringToDraw, Font, e.Node.ForeColor, e.Node.Bounds.X + (hasImage ? imageWidth + 2 : 0), e.Node.Bounds.Y - (int)scrollIndex - 2, (WrapText ? Width : Width * 16), e.Bounds.Height + 4, ContentAlignment.MiddleLeft);
// End of drawing.
DrawNode(this, e);
}
private TreeNode _SelectAtPosition(MouseEventArgs e)