Dictionary<int, Image> dic = new Dictionary<int, Image>();
/// <summary>
/// 图片对应的名称
/// </summary>
public static Dictionary<int, string> dicStr = new Dictionary<int, string>();
int keyIndex = 0;
#region 加载图片
ResourceManager rm = Properties.Resources.ResourceManager;
ResourceSet rs = rm.GetResourceSet(new CultureInfo("en-US"), true, true);
if (rs != null)
{
var images =
from entry in rs.Cast<DictionaryEntry>()
where entry.Value is Image
select entry;
foreach (DictionaryEntry img in images)
{
dic.Add(keyIndex, (Image)img.Value);
dicStr.Add(keyIndex, (string)img.Key);
keyIndex++;
}
}
#endregion
如何循环获取WINform的resource下的图片
最新推荐文章于 2023-04-05 20:00:00 发布