Solved

How to load 55 Images into 10 pictureBoxs ?

Posted on 2004-09-01
8
210 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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