Re: Image FromStream GDI+ Error with PictureBox
- From: "Matthew" <mroberts_hm@xxxxxxxxxxx>
- Date: 27 Oct 2005 08:23:14 -0700
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
.
- Follow-Ups:
- Re: Image FromStream GDI+ Error with PictureBox
- From: Michael Phillips, Jr.
- Re: Image FromStream GDI+ Error with PictureBox
- References:
- Image FromStream GDI+ Error with PictureBox
- From: Matthew
- Re: Image FromStream GDI+ Error with PictureBox
- From: Michael Phillips, Jr.
- Image FromStream GDI+ Error with PictureBox
- Prev by Date: DRAW IMAGE with "double" TRANSPARENCY
- Next by Date: Re: DRAW IMAGE with "double" TRANSPARENCY
- Previous by thread: Re: Image FromStream GDI+ Error with PictureBox
- Next by thread: Re: Image FromStream GDI+ Error with PictureBox
- Index(es):
Relevant Pages
|