Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to load 55 Images into 10 pictureBoxs ?

Posted on 2004-09-01
8
Medium Priority
?
216 Views
Last Modified: 2010-04-15
Hi
Could someone tell me how to do some kind of photo album in windows forms?
I have 55 images stored in resource file, and on my Form I have 10 pictureBoxes. I need to load these images into 10 picturesBoxes, but it must be done one by one I mean when I click for example on some button I want to see first 10 images next time when I click button next 10 images should be loaded into picturesBoxes and so on.

I know how to get images from resource file, but I have no idea how to handle swapping images. Moreover, I think there will be a problem with the five last images since it is 10 pictureBoxes on my form.

Does anyone have an idea how to do it?
I will appreciate any pointers.

Thanks





0
Comment
Question by:knobloch
  • 4
  • 2
  • 2
8 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 11960235
Are you making a thumb nail kind of thing?
if yes try this approach
http://www.codeproject.com/csharp/thumbgenerator.asp


About the question of 10 loading at a time..
When you have last last 5.
Place them in first 5 and leave the last 5 blank. Or put a gerneal purpose image on them
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11960241
0
 

Author Comment

by:knobloch
ID: 11964164
It just making thumbs.
 I need to load images into pictureBoxes and show them on Form.
I can show at most 10 at the same time.
Thanks anyway
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:kolpdc
ID: 11971229
only a small idea:

1. search all pictures in your directory and store their names in a list or array
2. remember the index of the first picture currently to show (in this initial case 0)
3. fill the picturebox with the first ten pictures found in your array
-> so you have ten pictures shown

4. to let the user navigate through your pictures provide a previous- and a next-button
-> if someone pushes next place your index + X (10?) if there are still enough images left to be shown
-> if someone pushes prev place your index - X as long as it is >0

i do not know, if this idea would solve your problem? which coding-language do you like to use?
0
 
LVL 4

Accepted Solution

by:
kolpdc earned 2000 total points
ID: 11971271
a - sorry. probably c# ;).

IList lstPictures = new ArrayList();
int   iIdx           = 0;

private void fillListWithPictures(
         ref IList p_lstPictures,             //our picturelist to be filled
         string    p_sPath)                   //path where images can be found
{
          try {
                //Control if there is a directory
                if (Directory.Exists(p_sPath)) {

                    DirectoryInfo di = new DirectoryInfo(p_sPath);
                    FileInfo[] rgFiles = di.GetFiles("*.jpg");
                    foreach(FileInfo fi in rgFiles) {
                        p_lstPictures.Add(fi.Name);
                    }
                }
            }
            catch (Exception) {}

} //fillListWithPictures


private void fillPictureBoxes(
         IList p_lstPictures,             //our picturelist
         int   p_iIndex)                   //index of first image in list to be shown
{
         try {
               for(int i=0; i < 10; i++) {

                    //Get picturefilename from list at i
                    //Add it to the picturebox corresponding to index i
                }
         }
         catch(Exception) {}
} //fillPictureBoxes


private void moveNext(
         IList      p_lstPictures,             //our picturelist
         ref int   p_iIndex)                   //index of first image in list to be shown
{

}


private void movePred(
         IList      p_lstPictures,             //our picturelist
         ref int   p_iIndex)                   //index of first image in list to be shown
{

}
0
 
LVL 4

Expert Comment

by:kolpdc
ID: 11971272
lacking time at the moment. tell me if you need more.
0
 

Author Comment

by:knobloch
ID: 11972084

I was just looking for something like this.
 Thank, a lot
0
 
LVL 4

Expert Comment

by:kolpdc
ID: 11972233
no problem - you're welcome.

if it does not reach, tell me.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question