heres what i want to do.

i want to add a button somewhere here.


When that button is clicked. The print screen function will caputure the form and i'll be getting something like:


I found this code from google but did not know how to implement.

Private Shared Function BitBlt( _
ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, _
ByVal nYDest As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, _
ByVal nXSrc As Integer, _
ByVal nYSrc As Integer, _
ByVal dwRop As Integer _
) As Boolean
End Function

Private Shared SRCCOPY As Integer = &HCC0020


buffer.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg)
buffer.Private Sub SaveFormToFile(ByVal sourceForm As Form, ByVal filename As String)
Dim formGraphics As Graphics = sourceForm.CreateGraphics()

bufferRect = sourceForm.ClientRectangle
Dim buffer As Image = New Bitmap(bufferRect.Width, bufferRect.Height, formGraphics)
Dim bufferGraphics As Graphics = Graphics.FromImage(buffer)

Dim formDC As IntPtr = formGraphics.GetHdc()
Dim bufferDC As IntPtr = bufferGraphics.GetHdc()

BitBlt(bufferDC, 0, 0, bufferRect.Width, bufferRect.Height, formDC, 0, 0, SRCCOPY)


End Sub