473,796 Members | 2,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I clear an Image

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 OutOfMemoryExce ption
exception.

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

Cal
Nov 20 '05 #1
5 9108
PictureBox1.Ima ge = Nothing

Hexathioorthoox alate
" active" <ac****@REMOV Ea-znet.com> wrote in message
news:O6******** ******@TK2MSFTN GP12.phx.gbl...
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 OutOfMemoryExce ption
exception.

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

Cal


Nov 20 '05 #2
* " active" <ac****@REMOV Ea-znet.com> scripsit:
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 OutOfMemoryExce ption
exception.


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

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Should have been my first guess. I'm not into this class/object thing enough
yet.

Thanks
Cal
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uY******** ******@tk2msftn gp13.phx.gbl...
* " active" <ac****@REMOV Ea-znet.com> scripsit:
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 OutOfMemoryExce ption
exception.


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

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #4
" active" <ac****@REMOV Ea-znet.com> schrieb
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
OutOfMemoryExce ption 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.ima ge = nothing

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

dim g as graphics
g = picturebox1.cre ategraphics
g.clear(picture box1.backcolor)
g.dispose
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

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

If you want to clear the image you painted in the paint event (or OnPaint):
dim g as graphics
g = picturebox1.cre ategraphics
g.clear(picture box1.backcolor)
g.dispose

I'll save this for whenm I need it

Thaks
Cal
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5729
by: Florian Brucker | last post by:
Hi! I've got a problem with float & clear. Take this example code: <div style=" width:100px; height:100px; background-color:#FF0000; float:left; margin:10px;"></div> <span style="clear:left;">This is some text</span> In Mozilla 1.6 the span still floats around the image on the left side (as if there wasn't a "clear" option). When I use
3
2372
by: steflhermitte | last post by:
Dear cpp-ians, I have a class: class mImage { public: //constructors / destructor mImage(unsigned int nrLayers); ~mImage();
0
1397
by: Paul E Collins | last post by:
Hello. I want to display a number of individual blocks of text. Each block has an associated image, which should be displayed on the right and aligned with the top of its block of text, i.e. (use a fixed-width font to view this!) Some short text. +-------+ | | +-------+
2
20977
by: Tomomichi Amano | last post by:
Hello How can I delete (clear) lines that were made useing Graphics.DrawLine() ? Thanks in advance! Have a nice day!
7
2056
by: moondaddy | last post by:
I'm painting images onto a windows form using this method: e.Graphics.DrawImageUnscaled(m_ItemImage, x, y) every time I select a product. However, some products don't have an image so when a user selects a different product from a list and that product doesn't have an image, I need to clear the image from the previous product that was painted onto the form. I was thinking of creating a clear image and using the DrawImageUnscaled
3
9224
by: Peter | last post by:
..NET 2.0 I have an Image on my form and I am trying to clear this image and re-load it with different image. Everything works fine, but once I load the image I can not delete this image until I close the program. How can I clear the image so I can delete it. Here's my code: string imgFileName = @"C:\myImage.jpg";
1
2042
by: laurakr | last post by:
I am trying to use a clear to get my bottom nav bar below the quote box on the right, but it isn't working. I would like the bottom edge of the quote box to "stick" to the footer nav bar but copy to be able to flow to the left of the quote box. For the bonus round I would like the right edge of the box to align with the right edge of the footer Could someone take a look at my code and help a newbie troubleshoot? my email is lroeder at...
3
5950
by: ffrugone | last post by:
I am creating a blog and I have a problem which seems fairly common: Within the content of the posts I sometimes have floated images. The comments bar that follows each post will not clear the float unless I use clear:both in the class for the comment bar. HOWEVER, when clear:both is used for the comment bar, the first post on the blog shows a huge, (enormous) vertical gap between the content and the comment bar when viewed using...
0
1755
by: williamr4j | last post by:
Very first thing, after preloader, is a blurry image that is supposed to get clear when mouse goes over the image. Problem is, the image that is clear will not, when previewing the movie, move from the top left corner. It is supposed to be right on top of the other image, which is in the middle of the screen. when i go into the layer that the clear image is it is right over the blurry image. I don't understand why, and have tried many different...
0
9529
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10457
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2927
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.