ocbeta Posted October 20, 2003 Posted October 20, 2003 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. Quote
ocbeta Posted October 20, 2003 Author Posted October 20, 2003 Ok, Well I figured it out. 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 wouldn't help the system memory issue. Or is there an API or DLL I should look into? Thanks for all of the help. Quote
ocbeta Posted October 20, 2003 Author Posted October 20, 2003 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. Quote
*Experts* Nerseus Posted October 21, 2003 *Experts* Posted October 21, 2003 I'm 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, I'd rename your variable from Image to something else that doesn't match the class name (I'm 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 Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
ocbeta Posted October 24, 2003 Author Posted October 24, 2003 (edited) 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 don't need to be recreated. Just a thought. Any ideas? Edited October 25, 2003 by ocbeta Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.