读书人

怎么获取资源中的图片数量

发布时间: 2011-12-12 22:59:56 作者: rapoo

如何获取资源中的图片数量
我把一个资源文件ComponentImage.resx嵌入到了DLL里,我已经测试过用下面的方法获取图片,是成功的:
ResourceManager resourceManager = new ResourceManager( "BusinessResource.Images.ComponentImage ", Assembly.GetAssembly(typeof(ImageResource)));
Image image = resourceManager.GetObject(name) as Image;

现在我想获取资源里的图片数目和他们的名字,而不是用已知的名字去获取图片.
查了很多资料都没有查到.望高手赐教.

另同时想请教读取Resource.resx文件的方式,如何获取图片的名称和数量.

[解决办法]
ResourceReader类
遍历GetEnumerator方法返回的IDictionaryEnumerator来枚举资源
IDictionaryEnumerator提供方法读取下一个资源名称和值

读书人网 >C#

热点推荐