Reputation: 8340
the following is an example of test code, it maybe not be completely correct:
for (int i = 0; i < MAXCOL; i++)
{
for (int j = 0; j < MAXROW; j++)
{
HomeArrayPicBox[i, j].Image = Properties.Resources.scan;
}
}
my issue is instead of all pictureboxes displaying the same picture, i need to increment the image also. e.g. Properties.Resources.scan1, Properties.Resources.scan2 ...
please adive how best to achive this.
thank you.
Upvotes: 1
Views: 1760
Reputation: 888203
You can get an object from a Resources file by name like this:
HomeArrayPicBox[i, j].Image =
(Image)Properties.Resources.ResourceManager.GetObject("Scan" + i);
Upvotes: 4
Reputation: 662
You can put all image object you need in an array. The length of this array should be MAXCOL * MAXROW. I assume you have the same number of images as boxes? Than you could iterate trough this array.
Upvotes: 0
Reputation: 18877
Make scan an array of image resources, and on each iteration, determine the correct index of that array to populate the picture box with.
Upvotes: 0