"rmacias" <rm*****@newsgroup.nospam> wrote in message
news:B2**********************************@microsof t.com...
Yes, when you open a bitmap from a Stream, the Stream must remain open.
When
you open it from a file, the file remains locked.
Do you know the reason behind this? It doesn't seem necessary to me if
everything is copied into memory anyway.
I'm not sure exactly what you are doing with the image when you pass it
around, or where exactly you are passing it around. What about reading in
the image as an array of bytes and passing that around?
Typically an image will be grabbed from a source (could be database, file,
directshow, twain, wia, clipboard or even custom hardware). The image will
be passed to a control that displays a small version of it. If the user
double clicks it it gets passed to another form to display full screen. If
the user decides to keep the image it is then passed to be saved into the
database and passed to another form which displays all images. From there it
can be passed around to all sorts of places to display, edit, print, delete,
email it etc. It's also stored in an image cache to speed up loading if
users are scrolling between images.
To keep the stream open or the file locked during all of this is impracticle
(eg if a user imports a file into my app the file should then be able to be
deleted (or if the user so specifies then my app will delete it)). Currently
I just create a copy of the bitmap which does work but is quite inefficient.
I've ordered a book about dot net imagine so hopefully that will shed some
light on what is actually happening. The help is pretty poor really and
usually only explains what obvious anyway. :-)
Michael