Problem getting TreeView control to display node images. The code below sometimes works, but at other times the image is not displayed.
private TreeNode AddNodeForCore(TreeNode root, Core c) {
string key = GetImageKey(c);
TreeNode t = root.Nodes.Add(c.Name, c.Name, key, key);
t.Tag = c;
return t;
}
Note that on failure, TreeView cannot display images for any node. TreeView has an ImageList assigned to it, and the image key is definitely in the image collection.
Edit:
My google-fu is weak. I canβt believe that I myself did not find this answer.
source
share