GDI+: Problem with PictureBox

M

MAY

Hello,
I drew some lines and rectangles with pen and brush on a picturebox, i want
convert these lines into bitmap. How can i do that??
Thanks in advance!

MAY
 
M

MAY

Thx Jax

In the other side, how to convert lines that drew on a picturebox into
bitmap??

MAY
Jax said:
Yeah, you gotta remember that a picturebox is for displaying and not editing.
What you want to do is this:

Bitmap myBitmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(myBitmap);
/// do stuff with g
pictureBox1.Image = myBitmap;

Here is an awesome FAQ on the GDI that helped me out tons.
http://www.dotnet247.com/247reference/a.aspx?u=http://www.bobpowell.net/gdiplus_faq.htm
 
S

Scatropolis

What he's saying is you don't want to draw the lines on the picturebox itself.
Rather make an Image and put the image on the pictureBox. You can then use
something like

then you could

myBitmap.Save("C:\\stuff.png"); //or bmp but the defaul is png
 
G

Guest

I gotta work on my communication skills, if two other people have to explain my post after i've written it. :
Thanks guys!
 
G

Guest

Hi Jax,
I gotta work on my communication skills, if two other people have to explain my post after i've written it. :)
Thanks guys!

I'm sure that You really don't have to!

We have tried to make this news branch deeper... and deeper...
.... but that subject was not so philosophical as we have expected.

;)

Marcin
 

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