Picture & Streamer : closed or not?
-
In my application, I've created a zip where I store several pictures (256 colors gif) When my application is loaded, I want to open the zip and load the gif in memory, but it doesn't work as I want, and I'd like some help. Here is what I do( it's very simplified) Method 1: FileStream stream // Read the contains of the zip with this stream, // it create Foo.gif (this part works) stream.Close(); Bitmap Picture = new Bitmap ("Foo.gif"); File.Delete("Foo.gif"); I don't want to keep the file on the hard drive, so I delete it once it is loaded. Pb : I got an error message at runtime "Foo.gif used by another process", and I cannot delete it. But the Stream is supposed to be closed. How can I delete this file? Method 2: Instead of using a FileStream to read the zip and save it, I use a MemoryStream, and I create the picture from this stream. It works. Almost. Instead of a 256 colors picture, It create a 32bppArgb picture, so it takes a lot of memory. Any idea of how I can access the picture in my zip, use them as 256 colors gif, and still be able to delete the picture once I'm done loading it?