I'm using a treeview-control in winforms and an imagelist to display different states of the treeview-elements.
But i don't want to use the selected element to use a different image.
Is there a way to disable SelectedImageIndex in the TreeView-control?
If tried to change the selectedimageindex after every selection. Something like this:
private void TreeView1AfterSelect(object sender, TreeViewEventArgs e)
{
treeView1.SelectedImageIndex = treeView1.SelectedNode.ImageIndex;
}
But this causes a pretty ugly flickering of the control after every selection..
Best Answer
When you are creating the new
TreeNode
, assign the same imageindex toImageIndex
andSelectedImageIndex
: