I am currently trying to save a windows form as an image, and I have been able to using the following code:
Dim frm = Me
Using bmp = New Bitmap(frm.Width, frm.Height)
frm.DrawToBitmap(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height))
bmp.Save("D:\programs\files\image.png")
End Using
However, the image includes the borders of the form. Is there any way to save the image without the borders?
Can you change the border style to none before the picture, then add it back after you save the picture... something like...
Dim frm = Me
frm.FormBorderStyle = FormBorderStyle.None
Using bmp = New Bitmap(frm.Width, frm.Height)
frm.DrawToBitmap(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height))
bmp.Save("D:\programs\files\image.png")
End Using
frm.FormBorderStyle = FormBorderStyle.FixedSingle