Solved

How to load 55 Images into 10 pictureBoxs ?

Posted on 2004-09-01
8
207 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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:knobloch
Comment Utility
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
 
LVL 4

Expert Comment

by:kolpdc
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Accepted Solution

by:
kolpdc earned 500 total points
Comment Utility
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
Comment Utility
lacking time at the moment. tell me if you need more.
0
 

Author Comment

by:knobloch
Comment Utility

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

Expert Comment

by:kolpdc
Comment Utility
no problem - you're welcome.

if it does not reach, tell me.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
The Using statement in C# 5 35
getting id from database 5 24
Hide Tab Page 3 18
Long URL in SMS 6 23
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now