|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I save a Graphics to a bitmap file?I paint into a PictureBox with the help of its Graphics object.
How can I save the painting into a bitmap file (not a metafile) ? Thanky in advance for any helpful hint. just copy-paste this in your Save method :
Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap(bmp,new Rectangle(0,0,pictureBox1.Width, pictureBox1.Height)); bmp.Save(@"temp.jpg", ImageFormat.Jpeg); make sure you replace pictureBox1 by the name of your picturebox and temp.jpg to the filename you want and ImageFormat.Jpeg by the format you want too... ;) I hope it helps ThunderMusic Show quote "myNickname" <myNickn***@discussions.microsoft.com> wrote in message news:9A091C0F-B100-4D04-966F-5E37825BFDAC@microsoft.com... >I paint into a PictureBox with the help of its Graphics object. > How can I save the painting into a bitmap file (not a metafile) ? > > Thanky in advance for any helpful hint. How about in .NET 1.1 using VS.NET 2003?
Thanks, Martin Show quote "ThunderMusic" wrote: > just copy-paste this in your Save method : > > Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); > pictureBox1.DrawToBitmap(bmp,new Rectangle(0,0,pictureBox1.Width, > pictureBox1.Height)); > bmp.Save(@"temp.jpg", ImageFormat.Jpeg); > > make sure you replace pictureBox1 by the name of your picturebox and > temp.jpg to the filename you want and ImageFormat.Jpeg by the format you > want too... ;) > > I hope it helps > > ThunderMusic > > > "myNickname" <myNickn***@discussions.microsoft.com> wrote in message > news:9A091C0F-B100-4D04-966F-5E37825BFDAC@microsoft.com... > >I paint into a PictureBox with the help of its Graphics object. > > How can I save the painting into a bitmap file (not a metafile) ? > > > > Thanky in advance for any helpful hint. > > > |
|||||||||||||||||||||||