Skip to main content
gamedev.net
🔒 Locked

[.net] Quick .NET question

Started by doctorhair1 3 replies 1k views
Original Post
doctorhair1
doctorhair1
Hey I'm fairly new to .NET but luckly I am pretty familer with C++/C# so I so far have been able to guess my way around how to do things until just now. My question is though I have users select a bunch of images and it generates a preview on the fly (example: http://www.stvproductionz.com/images/gallery(4).jpg). But I can't delete the images when the user chooses too. It just deletes the last image generated when I referance it by name. Any ideas? Maybe a way to loop through a list and delete them all? Thanks. This will also be useful for me to learn so I can edit the images. :)
Enselic
Enselic
Quote:
Original post by doctorhair1
But I can't delete the images when the user chooses too. It just deletes the last image generated when I referance it by name.

I am uncertain of what you mean here; do you by 'delete image' mean 'delete image from harddisk'? So the thumbnails are temporary image files on the harddisk?

I guess some code would help.
RipTorn
RipTorn
If you are no longer referencing the object (System::Drawing::Image), then the garbage collector will eventually collect it up and free the memory for you.
However, Image is an example that uses unmanaged memory (it wraps GDI+), so calling Dispose() when you no longer need it will speed this process up by dumping the unmanaged memory immediatly.

So pretty much emptying the list will effectivly delete the objects from memory.
doctorhair1
doctorhair1
When I do that it only erases one of the images from the displayed images though when I call Dispose(). Maybe I am doing something wrong. I'll post my code tonight.
philprice
philprice
A code example would be very useful in this case ;)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.