load multiple picture box in panel

hi, I need to load multiple image in a window, the problem is when I'm loading so many images, lets say about 500 or more images it throws out of memory exception, another problem is the height property of the control is only limited to about 32,000, when I try to add many pictureBox it does not fit in the panel control and some pictureBox are not display, here's my codes ..

private void Form1_Load(object sender, EventArgs e)
string imageDirectory = @c: empmyImages;

string[] imageFileList = Directory.GetFiles(imageDirectory);

int iCtr = 0;
foreach (string imageFile in imageFileList)
PictureBox eachPictureBox = new PictureBox();
eachPictureBox.Size = new Size(850, 1100);
eachPictureBox.Location = new Point(1, iCtr * 1100 + 1);
eachPictureBox.Image = Image.FromFile(imageFile);




I try to load it when the window form loads, any tips will be much appreciated, thanks ..
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!