Solved

How to load 55 Images into 10 pictureBoxs ?

Posted on 2004-09-01
8
212 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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