Good afternoon. This had been working for several weeks, but something's
changed and now my images are no longer visible in my TreeView!
I've confirmed that the image file is in place and loaded correctly. I've
confirmed that the ImageList is valid. I can reference imageList.Images[x]
and access my icons just fine. However, if I add nodes to a TreeView and set
their ImageIndex and SelectedImageIndex properties, I still see blank white.
This persists whether the nodes are selected or not.
It's not merely referencing the 0th element of the list, which had been
blank white: for testing I made non-white.
If the ImageList is valid, and the nodes' image indices are set, is there
some obscure setting in TreeView that I need to enable display of images?
Any ideas are appreciated!
Code:
ImageList imageList = new ImageList();
//imageList.ColorDepth = ColorDepth.Depth32Bit; // Has no effect
imageList.ImageSize = new Size(20, 20);
imageList.Images.AddStrip(global::MyNamespace.Properties.Resources.My_Icons);
TreeTemp.ImageList = imageList;
for (int j = 0; j < 4; j++)
{
TreeNode node = new TreeNode(j.ToString(), j, j);
TreeTemp.Nodes.Add(node); // Show as blank white
}
TreeTemp.Invalidate(); // No effect
BackgroundImage = imageList.Images[0]; // Displays test graphic as expected