How do I save a PictureBox to a graphics file?

furjaw
03-17-2006, 11:00 PM
Visual Basic 2005 Express Edition:

I want to save a PictureBox (background image and foreground image combined) to a filename.

How do I do this?

jo0ls
03-17-2006, 11:10 PM
Ask the picturebox nicely, and it will draw itself into a bitmap (which you can save)

'
Dim bm As Bitmap = New Bitmap(PictureBox1.ClientSize.Width, PictureBox1.ClientSize.Height)
PictureBox1.DrawToBitmap(bm, PictureBox1.ClientRectangle)
bm.Save("C:\test.png", System.Drawing.Imaging.ImageFormat.Png)

furjaw
03-18-2006, 11:22 PM
Thank You! Worked Great!!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum