如何从资源文件填充ImageList [英] How to populate an ImageList from a Resource File
本文介绍了如何从资源文件填充ImageList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是想知道是否存在一种从资源文件填充ImageList的方法.我在网上四处张望,但一切似乎都来自2003/2005年.
Just wondering if there is a way to populate an ImageList from a Resource file. I have looked around on the web, but everything seems to have been from back in 2003/2005.
任何建议,谢谢您.
推荐答案
这里是将资源中的所有图像读入ImageList的示例.
Here is an example of reading all images in a resource into an ImageList.
var dynamicImageList = new ImageList();
var resourceSet = MyResourceClass.ResourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, false);
if (resourceSet != null)
{
foreach (DictionaryEntry entry in resourceSet)
{
var value = entry.Value as Bitmap; //only get images
if (value != null)
{
dynamicImageList.Images.Add((string) entry.Key, value);
}
}
}
这篇关于如何从资源文件填充ImageList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文