Resource using by System.Drawing.Image

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hello...
i found what if i load image from file to System.Drawing.Image img object,
and then assign this img to PictureBox.Image property and then trying to
delete this graphics file or rename it, it gives me en error of that the
file is unaccesseable even in WindowsExplorer it writes that the file is
used by another program...
I tried to use PictureBox.Image = null and even PictureBox.Dispose(), but
nothig helped....

maybe someone has other solution?

thnx...
 
David said:
i found what if i load image from file to System.Drawing.Image img object,
and then assign this img to PictureBox.Image property and then trying to
delete this graphics file or rename it, it gives me en error of that the
file is unaccesseable even in WindowsExplorer it writes that the file is
used by another program...
I tried to use PictureBox.Image = null and even PictureBox.Dispose(), but
nothig helped....

maybe someone has other solution?

Disposing both the Image and the PictureBox should work - but you could
also load the file into memory and then create an image from that (e.g.
using FromStream, passing in a MemoryStream).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top