Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I hope I am posting this in the right place.

 

I am making a PictureBox that shows a file called 'lookoout.jpg'

The 'lookout.jpg' is generated by a motion camera (everytime there is motion).

 

What I would like, is for the PictureBox to Display Lookout.JPG, and then delete the 'lookout.jpg' (and then display it again while the other image is still showing).

 

Form2 just has a picture box on it, with a close button.

 

-------------------------------------------

Dim form2settings As New Form2()

form2settings.Show()

-------------------------------------------

Close Button -

-------------------------------------------

System.IO.File.Delete("lookout.jpg")

--------------------------------------------

 

Proble: lookoout.jpg is in use by the PictureBox, and cannot be deleted. Is there a way to load the picture into memory so I can delete the original file?

 

Thanks in advance!!

  • *Experts*
Posted

Try this:

Dim b As Bitmap = New Bitmap("lookout.jpg")
Dim newBitmap As Bitmap = b.Clone();
PictureBox1.Picture = newBitmap

 

I haven't tested this... :)

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

I tried:

------------------------------------------------------------------------

Dim b As Bitmap = New Bitmap("lookout.jpg")

Dim newBitmap As Bitmap = b.Clone()

b.Dispose()

PictureBox1.Image = newBitmap

------------------------------------------------------------------------

But file is still in use when picture is displayed.

 

Thanks for the idea tho'

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...