VB.Net Thumbnail Question

ocbeta

Member
Joined
Oct 15, 2003
Messages
10
Location
Learning Curve
I have a quick question. I am looking to create a series of thumbnails that you can scroll.

I am not quite sure which way to go with it.

Here are some ideas:

I can use a loop so that all of the files that match a search argument will execute code that creates a new picture box. But then the question becomes how do I related each of those picture boxes to each other so that the scroll events will triger movement with all of them.

Also, the scroll area is smaller then the rest of the program. So I would then like to be able to set coordinates for clipping.

But I think an issue would be if there was 100mb of files that would be too much to store in memory, so I would like to dynamically load and unload the files.

So I am not too sure which way to go. And I am at a loss.

Thanks for everyones help.
 
Ok, Well I figured it out.


Code:
            Dim Image As Image = Image.FromFile(File.FullName)
            Dim Thumbnail As Image = Image.GetThumbnailImage(50, 50, Nothing, Nothing)
            Dim pic As New PictureBox()
            pic.Image = Thumbnail
            pic.Dock = DockStyle.Top
            Panel2.Controls.Add(pic)

Now the next issue. Hopefully one of you can get it before I can :D

I am willing to look through C# code also. This is parially how I got the above code.

(Simple I know, but I am a n00b)

The problem that I am having is that when I parse about 75mb worth of images the program will show not responding, and also, the program will use about 150-350mb of system memory.

Is there any ideas? Should I run a background thread? That would allow the software to be usable, but wouldnt help the system memory issue.

Or is there an API or DLL I should look into?


Thanks for all of the help.
 
Any Ideas on how to manage memory a little better?

Just point me in the right direction.

I am thinking perhaps a byte stream, or a file stream.
 
Im not sure about the memory usage - the garbage collector should be clearing out the original bitmaps when it runs (when it determines it should) as there are no references to the original image. By the way, Id rename your variable from Image to something else that doesnt match the class name (Im surprised VB even compiles that).

As for the response time, you can call Application.DoEvents() in your loop to give the machine a chance to process windows messages (allows moving windows, switching to other windows, etc.). Basically allows your CPU intensive operation to play nice with the OS.

-Ner
 
Thanks for the info.

Perhaps,
I was thinking, that I could create the thumbnails. Then open them from a file stream. To display them. That way if the thumbnails are created, they dont need to be recreated.


Just a thought.

Any ideas?
 
Last edited by a moderator:
Back
Top