Solved

How to load 55 Images into 10 pictureBoxs ?

Posted on 2004-09-01
8
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF user control poped up from a window 1 51
How to force output to ascii 2 62
Need help with another query 10 54
Run software updates from the website 6 50
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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