how to load more than 300 image to picture boxes

sarmad

Active member
Joined
Jan 22, 2006
Messages
37
Programming Experience
1-3
hi

i have to load the 300 image in the 300 picture box

i was put the all of image in listimage

then for set the picturebox

i want to use this

for i=1 to 300

picturebox(I).image=listimage1.image(I)

next


but in "picturebox(i) i got error

its mean that i cant use index for picturebox?

so what i have to do?

if there is another way please post it

thank
 
A picturebox doesn't have an index it is merely for displaying images. If you have loaded your pictures into an imagelist then you can set the image for the picture box from your imagelist....

VB.NET:
me.picturebox.image = me.imagelist.images.item(the index of the image you want to show)

Is this what you are trying to accomplish?
 
hi

thanks but no its not.

i have 300 picturebox and i have to load a 300 image

but i dont know how to do that?

so thanks
 
Add all the PictureBoxes to a Panel and use it's Controls collection
VB.NET:
For i As Integer = 0 To 299
  DirectCast(Panel1.Controls(i), PictureBox).Image = ImageList1.Images(i)
Next
 
Are you really sure that you want to have 300 PictureBoxes? I guess there could be reasons for it but it sounds unusual. Perhaps you could tell us what you're trying to achieve.
 
I totally agree with your question, jmcilhinney. 300 pictureboxes does sound like just another "I'm in love with VB6, don't VB.Net got control arrays?"...
 
JohnH said:
Add all the PictureBoxes to a Panel and use it's Controls collection
VB.NET:
For i As Integer = 0 To 299
  DirectCast(Panel1.Controls(i), PictureBox).Image = ImageList1.Images(i)
Next


thnaks it works fine

but why the image when load from listimage have bad quality?

the colordepht also set to 32 bit

but the quality is not best

thanks
 
If you changed colordepth after you added the images to imagelist, then they will be the imagelist default value 8bit .Net 1.1 (4bit .Net 1.0).

Set the depth to 32bit then add images.

::edit:: I tested 'another' and depth change was applied either way.. the first I had to remove images, change depth, then re-add. strange, but it's something you can test.
 
Last edited:
Back
Top