The following code will produce a �form� screen shot
Private Sub btnSave_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSave.Click
' Save the picture.
Dim bm As Bitmap = GetFormImage()
bm.Save("c:\newread\test.tif", System.Drawing.Imaging.ImageFormat.Tiff)
'Beep()
End Sub
Private Function GetFormImage() As Bitmap
Dim me_gr As Graphics = Me.CreateGraphics
Dim bm As New Bitmap(Me.ClientSize.Width, _
Me.ClientSize.Height, me_gr)
Dim bm_gr As Graphics = me_gr.FromImage(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc
Dim me_hdc As IntPtr = me_gr.GetHdc
BitBlt(bm_hdc, 0, 0, Me.ClientSize.Width, _
Me.ClientSize.Height, _
me_hdc, 0, 0, SRCCOPY)
me_gr.ReleaseHdc(me_hdc)
bm_gr.ReleaseHdc(bm_hdc)
Return bm
End Function
You�ll need to declare the BitBlt function and the variable SRCCOPY after your Public Class Form1
Private Declare Auto Function BitBlt Lib "gdi32.dll" (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 _
System.Int32) As Boolean
Private Const SRCCOPY As Integer = &HCC0020