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..
When you are creating the new TreeNode
, assign the same imageindex to ImageIndex
and SelectedImageIndex
:
...
node.SelectedImageIndex = node.ImageIndex;
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With