So I have a tree list that has these 2 nodes in them. This is the image and all it is is 2 tree nodes that look normal with am image. But when I select one I have code to chang the background but this is what happend. The background has changed and everything but the image has gone away. I was wondering if there was any way to change the background but still have the image? This is the code I got and it works but it could be a little better.
private void treeView1_DrawNode(object sender, DrawTreeNodeEventArgs e)
{
var i = e.Bounds;
i.Width = 1000;
i.X = -100;
if (e.Node.IsSelected)
{
if (treeView1.Focused)
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(233, 236, 244)), i);
}
else
e.Graphics.FillRectangle(Brushes.Transparent, i);
TextRenderer.DrawText(e.Graphics, e.Node.Text, e.Node.TreeView.Font, e.Node.Bounds, e.Node.ForeColor);
}
question from:
https://stackoverflow.com/questions/65648602/c-sharp-how-do-i-change-the-treeview-selected-background-color-but-with-the-imag 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…