0

I have a GUI with a button that will open a new window. As soon as the window opens I need it to be filled with a sires of pictures that I have stored in a dictionary of (string,bitmap) with the string representing the path name. Obviously I need to iterate across the dictionary but I don't know what code to use to display the pictures. Is there anyway to make a loop that will automatically display the images in a set size.

For a good example of the output I'm looking for, think windows explorer thumbnails when browsing a folder of pictures.

2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by Fenrir()
0

I used a FlowLayoutPanel to accomplish this some time back.

        foreach (KeyValuePair<string, int> pair in dictionary) 
        {
           //Create the picturebox

            PictureBox PicBox = new PictureBox();
            PicBox.Image = Image.FromFile(pair.Key); //Filename          
            PicBox.Dock = DockStyle.Bottom;
            PicBox.SizeMode = PictureBoxSizeMode.Zoom;
            PicBox.Height = 100;
            PicBox.Width = 100;
            flowLayoutPanel1.Controls.Add(PicBox);

        }

Hope this helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.