473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Image of a picturebox painted manualy

hello
I have apicturebox painted in it's paint event.
I need a way to save the image created. Image obj of my picturebox is
Nothing. How to output to a jpg my image?

Crirus
Nov 20 '05 #1
2 3193
"Crirus" <Cr****@datagroup.ro> schrieb
hello
I have apicturebox painted in it's paint event.
I need a way to save the image created. Image obj of my picturebox
is Nothing. How to output to a jpg my image?


Paint on a Bitmap instead of directly painting on the picturebox. In the
picbox' paint event draw the bitmap on the picturebox. The Bitmap can be
save to a JPG:

bmp.Save("myfile.jpg", Imaging.ImageFormat.Jpeg)

--
Armin

Nov 20 '05 #2
"Crirus" <Cr****@datagroup.ro> scripsit:
I have apicturebox painted in it's paint event.
I need a way to save the image created. Image obj of my picturebox is
Nothing. How to output to a jpg my image?


Draw the image onto a bitmap instead. Create a new 'Bitmap' object with
the preferred size ('Dim b As New Bitmap(...)'), then obtain a
'Graphics' handle ('Graphics.FromImage') and draw onto the bitmap. Then
you can draw the bitmap to the picturebox in its 'Paint' event handler.
You can save the image by calling 'b''s 'Save' method. Don't forget to
call the 'Graphics'' object's 'Dispose' method after you finish using it.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

1
by: marco | last post by:
I'm a newbie and i'm doing a little application that open image. I don't understand what i've to do to have a zoom of an image...i don't know where's the error. If anyone know a simple code tell me...
2
by: marco | last post by:
I'm a newbie and i'm doing a little application in C# for a Pocket PC that open image. I don't understand what i've to do to have a zoom of an image...i don't know where's the error. If anyone...
5
by: active | last post by:
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...
7
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...
6
by: Patrick Dugan | last post by:
Hello, I'm trying to load different images (icons) into a PictureBox1.Image. The first image loads just fine, but the second image always returns the error "Invalid property used." It doesn't...
3
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
4
by: John Swan | last post by:
Hello. I'm trying to create a simple program that amongst other things creates a thumbnail of an image (Bitmap) to a set size determined by the user in pixels? The problem is: All of the...
3
by: Andrzej | last post by:
I have a picturebox on my C# .NET form. The picturebox size mode is set to zoom. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.