Re: Image FromStream GDI+ Error with PictureBox



The stream is remaining open. However, I was unaware that the memory
stream becomes "currupt" once the bitmap is disposed. However, in this
case, I am simply trying to display one image without disposing of
either, and I still get the error. I have even tried using "FromFile",
and it will throw the error once the image tries to draw on the
PictureBox. If, however, I clone the bitmap and try to display the
clone, all is well.

My question then would be, if the methods I am using to cache images
are not working (by caching the file streams which are small, rather
than caching the entire image which is large once decompressed), how
can I cache the images in a small footprint manner so that I do not
have to retrieve them from the file system every time I want to display
them. I need speed when switching from one image to another, so reading
from the file system is not a solution. I thought by having the file
streams cached in memory, I would work it out, but obviously this is
causing problems in GDI+.

The even stranger thing is, I have this same caching technique in
another object model that we use in production. It works 99% of the
time, but then gives that error sometimes when it tries to paint. I
created a workaround by recreating the image controls whenever this
happens, but it is a hack.

So, what would you recommend to cache images in a small footprint for
fast display?

Thanks,
Matthew

.



Relevant Pages

  • Re: specifying path for file to be read by servlet with Tomcat
    ... > I'm trying to read a txt file to be used by a servlet to display ... FileInputStream needs parameters based on OS file system. ... get the stream from URL. ...
    (comp.lang.java.programmer)
  • Re: Loading a Remote file
    ... If I use Response.Write to display the HTML Contents, ... // Create a new stream to write to the file ... // Read contents of file into a string ... or the account IIS is using. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Loading a Remote file
    ... If I use Response.Write to display the HTML Contents, ... // Create a new stream to write to the file ... // Read contents of file into a string ... or the account IIS is using. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: network volumes & "dot files" (.DS_store, etc)
    ... The "other" sidecars are the file system metadata and ... potentially resource fork of the fileyou're transferring. ... created when the file system in use doesn't support the additional ... The other possible contents of those files are a stream of information ...
    (comp.sys.mac.system)
  • Re: Calling close on StringReader (or not)
    ... Stream object, which do require disposing. ... these readers deal with unmanaged resources. ... using (StreamReader reader = new StreamReader( ...
    (microsoft.public.dotnet.framework)