How do I clear an Image

A

active

In a PictureBox if I want to clear the Image or background do I simply use
FromFile("")
(just a guess)

I did see about FromFile:
If the file does not have a valid image format or if GDI+ does not support
the pixel format of the file, this method throws an OutOfMemoryException
exception.



Search all doc and msdn I could find - looks like nobody has need to clear
an image!





Cal
 
H

Herfried K. Wagner [MVP]

* " active said:
In a PictureBox if I want to clear the Image or background do I simply use
FromFile("")
(just a guess)

I did see about FromFile:
If the file does not have a valid image format or if GDI+ does not support
the pixel format of the file, this method throws an OutOfMemoryException
exception.

\\\
Me.PictureBox1.Image = Nothing
///
 
A

active

Should have been my first guess. I'm not into this class/object thing enough
yet.

Thanks
Cal
 
A

Armin Zingler

active said:
In a PictureBox if I want to clear the Image or background do I
simply use FromFile("")
(just a guess)

I did see about FromFile:
If the file does not have a valid image format or if GDI+ does not
support the pixel format of the file, this method throws an
OutOfMemoryException exception.



Search all doc and msdn I could find - looks like nobody has need to
clear an image!

You want to clear the image you assigned to the Image property? If yes:
picturebox1.image = nothing

If you want to clear the image you painted in the paint event (or OnPaint):

dim g as graphics
g = picturebox1.creategraphics
g.clear(picturebox1.backcolor)
g.dispose
 
A

active

"> You want to clear the image you assigned to the Image property? If yes:
picturebox1.image = nothing
YES


If you want to clear the image you painted in the paint event (or OnPaint):

dim g as graphics
g = picturebox1.creategraphics
g.clear(picturebox1.backcolor)
g.dispose
I'll save this for whenm I need it

Thaks
Cal
 

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

Top