Hi,
I am creating a new UserControl that has 3 PictureBox's, These three pictures show the start, middle and end frames of a video clip.
Multiple UserControls of this type will be shown in a list. So for a video of 100 clips we have 3 * 100 = 300 pictures.

My initial thought was to just use the async load of the pictureBox. However as these are potentially large jpegs, I would rather load them into memory and shrink them to fit the size of the pictureBox.

How do I do this with possibly 300+ photo's?.
I thought of using a thread per box, but then is 300+ threads possible.

Then I thought of using the thread pool, using ThreadPool.QueueUserWorkItem. Is this a valid idea.

What is the limit on the number of threads?

Would just using the pictureBox async load be OK anyway?

Regards,
John.

using the async load of the picturebox will work to an extent but eventually you will have loaded a ton of full size pictures into memory unnecessarily slowing down the system. alternatively you should consider creating a control from scratch that asynchronously reads the images from disk and creates a new image in the size you need and save it in a variable and on paint draw it to the surface of the control.

as for the threading the load, a thread pool would be the most efficient on a multiprocessor system, but otherwise a single worker thread should do fine. having the worker thread load the images, resize them, create the control, add the image to it and the pass that control object to the gui thread to be added to a container.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.