Inv*_*ion 5 c# embedded-resource
我在资源文件中有30个PNG,我想在计时器内迭代它们.此计时器将表单的背景图像设置为序列中的下一个PNG,以生成基本动画.
我找不到一种简单的方法来枚举资源文件并获取实际图像.我也热衷于保持对图像的引用不固定到它们的文件名,以便更新资源文件中图像的命名不需要我更新这部分代码.
笔记:
private void Form1_Load(object sender, EventArgs e)
{
var list = WindowsFormsApplication1.Properties.Resources.ResourceManager.GetResourceSet(new System.Globalization.CultureInfo("en-us"), true, true);
foreach (System.Collections.DictionaryEntry img in list)
{
System.Diagnostics.Debug.WriteLine(img.Key);
//use img.Value to get the bitmap
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8100 次 |
| 最近记录: |