473,480 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Save GDI+ as image

MAY
Hi,

I drew some lines on a form and i want convert these lines into a bitmap.
How can i do that?
MAY


Nov 16 '05 #1
4 8043
it's actually best to draw on a Image/Bitmap and put that image on the form.

pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Image bmp = pictureBox1.Image;
Graphics g = Graphics.FromImage(bmp);

//Edit bmp
g.FillRectangle(new SolidBrush(Color.White), 0, 0, pictureBox1.Width,
pictureBox1.Height);
for(int I=0; I < pictureBox1.Width; I+)
g.DrawLine(new Pen(Color.Black), pictureBox1.Width - I, 0, 0, I);

//Display bmp
pictureBox1.Image = bmp;
then to save the image all you'd have to do is make the image public or
something and

bmp.SaveTo("C:\stuff.png");

Hope that helps
On 06/05/2004 "MAY" <pa****@hotmail.com> wrote:
Hi,

I drew some lines on a form and i want convert these lines into a bitmap.
How can i do that?
MAY

Nov 16 '05 #2
MAY
Thx for help..

as this form will dynamic create drawing stuffs in run time thus cant change
picturebox.img. is there have other alternatives?
MAY
"Scatropolis" <ch*****@frayed.net> ???
news:Ol**************@TK2MSFTNGP11.phx.gbl ???...
it's actually best to draw on a Image/Bitmap and put that image on the form.

pictureBox1.Image =ew Bitmap(pictureBox1.Width, pictureBox1.Height);
Image bmp =ictureBox1.Image;
Graphics g =raphics.FromImage(bmp);

//Edit bmp
g.FillRectangle(new SolidBrush(Color.White), 0, 0, pictureBox1.Width,
pictureBox1.Height);
for(int I= I < pictureBox1.Width; I+)
g.DrawLine(new Pen(Color.Black), pictureBox1.Width - I, 0, 0, I);

//Display bmp
pictureBox1.Image =mp;
then to save the image all you'd have to do is make the image public or
something and

bmp.SaveTo("C:\stuff.png");

Hope that helps
On 06/05/2004 "MAY" <pa****@hotmail.com> wrote:
Hi,

I drew some lines on a form and i want convert these lines into a bitmap.
How can i do that?
MAY

Nov 16 '05 #3
MAY wrote:
Thx for help..

as this form will dynamic create drawing stuffs in run time thus cant change
picturebox.img. is there have other alternatives?

// Create an image 100 x 100 pixels
Image image = new Bitmap(100, 100);

// Get the Graphics object
using (Graphics g = Graphics.FromImage(image))
{
// Do your drawing here....
}
image.Save(filename, System.Drawing.Imaging.ImageFormat.Gif);

MAY
"Scatropolis" <ch*****@frayed.net> ???
news:Ol**************@TK2MSFTNGP11.phx.gbl ???...
it's actually best to draw on a Image/Bitmap and put that image on the form.

pictureBox1.Image =ew Bitmap(pictureBox1.Width, pictureBox1.Height);
Image bmp =ictureBox1.Image;
Graphics g =raphics.FromImage(bmp);

//Edit bmp
g.FillRectangle(new SolidBrush(Color.White), 0, 0, pictureBox1.Width,
pictureBox1.Height);
for(int I= I < pictureBox1.Width; I+)
g.DrawLine(new Pen(Color.Black), pictureBox1.Width - I, 0, 0, I);

//Display bmp
pictureBox1.Image =mp;
then to save the image all you'd have to do is make the image public or
something and

bmp.SaveTo("C:\stuff.png");

Hope that helps
On 06/05/2004 "MAY" <pa****@hotmail.com> wrote:
Hi,

I drew some lines on a form and i want convert these lines into a bitmap.
How can i do that?
MAY


--

Ed Courtenay
[MCP, MCSD]
http://www.edcourtenay.co.uk
Nov 16 '05 #4
MAY
Thx guys..... i got it!

"Ed Courtenay" <re*****************************@edcourtenay.co.uk > ???
news:uk**************@TK2MSFTNGP12.phx.gbl ???...
MAY wrote:
Thx for help..

as this form will dynamic create drawing stuffs in run time thus cant change picturebox.img. is there have other alternatives?


// Create an image 100 x 100 pixels
Image image = new Bitmap(100, 100);

// Get the Graphics object
using (Graphics g = Graphics.FromImage(image))
{
// Do your drawing here....
}
image.Save(filename, System.Drawing.Imaging.ImageFormat.Gif);

MAY
"Scatropolis" <ch*****@frayed.net> ???
news:Ol**************@TK2MSFTNGP11.phx.gbl ???...
it's actually best to draw on a Image/Bitmap and put that image on the form.
pictureBox1.Image =ew Bitmap(pictureBox1.Width, pictureBox1.Height);
Image bmp =ictureBox1.Image;
Graphics g =raphics.FromImage(bmp);

//Edit bmp
g.FillRectangle(new SolidBrush(Color.White), 0, 0, pictureBox1.Width,
pictureBox1.Height);
for(int I= I < pictureBox1.Width; I+)
g.DrawLine(new Pen(Color.Black), pictureBox1.Width - I, 0, 0, I);

//Display bmp
pictureBox1.Image =mp;
then to save the image all you'd have to do is make the image public or
something and

bmp.SaveTo("C:\stuff.png");

Hope that helps
On 06/05/2004 "MAY" <pa****@hotmail.com> wrote:
Hi,

I drew some lines on a form and i want convert these lines into a bitmap.How can i do that?
MAY


--

Ed Courtenay
[MCP, MCSD]
http://www.edcourtenay.co.uk

Nov 16 '05 #5

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

Similar topics

1
3501
by: Bassem | last post by:
Hi all I saved my imaged in SQL 2000 server database and now I want to get the values of the columns to text or xml file. The field I didn't could get it to the text file is the Image column...
3
11630
by: Alexli | last post by:
I got the error ================= An unhandled exception of typ 'System.Runtime.InteropServices.ExternalException' occurred i system.drawing.dl Additional information: A generic error occurred...
2
3841
by: Barry | last post by:
Hi Does anyone know why i am getting the following error message (line 64) , if i change to objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg) i do not get this error Exception...
3
2306
by: Rob Willaar | last post by:
Hi All, I try to draw text on a picturebox. The text appears but it is drawn on top of the picture. when i try to save the result the text is gone.
1
1689
by: DSchlichte | last post by:
Hello ' I need some help. I've created a little application to paint, save and load pictures (Bitmap-graphics) into ' a picturebox-object on the desktop. There's no problem to paint or to load...
1
6476
by: WB | last post by:
Hi, I have a helper class that has a method to resize images. It takes the virtual path of an image and resize it to a specified dimension like this. public void ResizeImageTest(string...
2
2636
by: Ada | last post by:
First of all, I thought this might be a directory security issue but it's not. I was able to upload the file to the directory via HTTP. Here's the situation. I have a JPG file on my server....
15
8302
by: Sharon | last post by:
Hello gurus, I have a System.IntPtr pointing to the memory address of my image (not a ..NET image). I wish to save this image data pointed by the IntPtr to a raw data file. The way I now to...
12
4014
by: Lee | last post by:
I have the following code using System; using System.Windows.Forms; using System.Drawing; using System.Collections; namespace FINN {
0
7041
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7081
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...
1
6737
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4776
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2995
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...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
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...

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.