I have 30 PNGs in a resource file and I would like to iterate around them inside a timer. This timer sets the form's background image to the next PNG in the sequence to produce a basic animation.
I can't find an easy way to enumerate the resource file and get at the actual images. I am also keen to keep the references to the images not fixed to their filenames so that updating the naming of the images within the Resource File would not require me to update this section of code.
Notes:
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
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With