Hello,
I'm trying to build an image library DLL that will contain a bunch of common images that we use in many applications we distribute to customers. I have been trying to use reflection to grab the icons out of the Resource files, which I can do using this code:
I can't seem to figure out how to list every resource in a base resource file though. I want to create a List<Image> object and return that value so that we can implement it easily into an ImageComboBox. I think I have to use a ResourceSet, but I'm not sure. Here is code I have so far, but I don't know where to go from here:Code:public Image GetIcon(string key, string category) { Assembly myAssembly; myAssembly = this.GetType().Assembly; ResourceManager manager = new System.Resources.ResourceManager("IconLibrary." + category, myAssembly); return (Image)manager.GetObject(key); }
Any help would be greatly appreciated. Also, I am using these pages from MSDN for reference:Code:public List<Image> GetIconList(string category) { List<Image> retval = new List<Image>(); Assembly myAssembly = this.GetType().Assembly; ResourceManager manager = new ResourceManager("IconLibrary." + category, myAssembly); ResourceSet ResSet = manager.GetResourceSet(new System.Globalization.CultureInfo("en-US"), false, false); // magic happens here ? return retval; }
http://msdn2.microsoft.com/en-us/lib...08(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...et(VS.71).aspx
(and links from those pages to other dependency classes)




Reply With Quote