I am creating a form, and on load it gets all images from my resources folder and for each file creates a new button, sets the buttons background image to that image and adds that button to the form, but it is only displaying 1 button and there are 36 files in the resources folder.
My code is as follows:
ResourceSet resourceSet = Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
foreach (DictionaryEntry entry in resourceSet)
{
object resource = entry.Value;
Button b = new Button();
b.BackgroundImage = (Image)resource;
b.BackgroundImageLayout = ImageLayout.Stretch;
b.Height = 64;
b.Width = 64;
this.Controls.Add(b);
}
Please assist on what I am doing wrong.