I'm using an imagelist with about 100 different icons to be used in a listview in a C# project using Winforms
The images are referred to by the listview by their index.
Now there has been a graphical overhaul, and all of the icons need to be replaced. What I did so far was open up the imagelist in the Visual Studio editor, delete image x with index 5, and then add a new version of image x.
The problem with approach is that when deleting image x, all other images with an index higher than 5 are shifted. And after adding the new version of the icon, I have to click the UP arrow about 95 times to get my new version at index 5 again.
Does anyone know a less painful, and less error prone method to achieve the same result?
Editing the .designer.cs file doesn't really help as it only lists the names of the icons and their index
//
// NavigatorImageList
//
this.NavigatorImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("NavigatorImageList.ImageStream")));
this.NavigatorImageList.TransparentColor = System.Drawing.Color.Transparent;
this.NavigatorImageList.Images.SetKeyName(0, "dummy.png");
this.NavigatorImageList.Images.SetKeyName(1, "Attribute.png");
this.NavigatorImageList.Images.SetKeyName(2, "Operation.png");
this.NavigatorImageList.Images.SetKeyName(3, "Element.png");
this.NavigatorImageList.Images.SetKeyName(4, "Diagram.png");
this.NavigatorImageList.Images.SetKeyName(5, "Package_element.png");
// ...continues like this for all items ....
The actual images are stored in the .resx file, but they are in a binary format, so also not really an option to edit them there
<data name="NavigatorImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB2
1gAAAk1TRnQBSQFMAgEBYwEAAYgBAgGIAQIBEAEAARABAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABkAEBAgABAQEAARAGAAHIJgABeAEtAfABHAHwARwB8AEcAfABHAHwARwWAAG4ATUBMAElATABJQEw
... and many many more lines like this...
I know referring to the images by their index might have been a mistake, but it's a bit late in the game to change that now
TL;DR
I'm looking for an easy way to replace the images in my imagelist without having to change my existing working code that relies on the image indexes.