How to convert .net Form to Image

  1. Public Class Form1
  2.  
  3.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  4.         CreateBitmap(Me)
  5.     End Sub
  6.  
  7.     Private Sub CreateBitmap(ByVal con As Control)
  8.         'Dim g As Graphics = Me.CreateGraphics()
  9.  
  10.         Dim b As Bitmap = New Bitmap(Me.Width, Me.Height)
  11.         Me.DrawToBitmap(b, New Rectangle(0, 0, Me.Width, Me.Height))
  12.  
  13.         b.Save("test.jpg", Imaging.ImageFormat.Jpeg)
  14.         b.Dispose()
  15.         'g.Dispose()
  16.     End Sub
  17. End Class

, ,

  1. No comments yet.
(will not be published)
Submit Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe to comments feed
  1. No trackbacks yet.

SetPageWidth