Re: From Graphics to Image

samir parekh <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
SORRY TO INTERRUPT....
 but there seems to be some misunderstanding..

set the image property of the picture box to the image after editing the image

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

Regards
samir

Fabian Schmied <[email protected]> wrote: > Graphics g = Graphics.FromImage(b);
>
> Then you should be able to use "g" to draw your graph on "b", and then use
> b.Save() to save the result, or g.DrawImage() to paint the image on the
> screen.

The first part is right, but if "g" is the Graphics object obtained
via Graphics.FromImage(b), then g.DrawImage won't paint the image on
the screen. Instead, it can be used to paint a different image on the
graphics object (which in turn paints on "b").

To show the image on the screen, you can use a PictureBox or a Paint
event's PaintEventArgs.Graphics.DrawImage().

Fabian










---------------------------------
Get the free Yahoo! toolbar and rest assured with the added security of spyware protection.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.