heres what i want to do.

i want to add a button somewhere here.

[IMG]http://aycu20.webshots.com/image/49619/2006148200319099889_rs.jpg[/IMG]

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

[IMG]http://aycu16.webshots.com/image/51455/2005462669515036518_rs.jpg[/IMG]

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

formGraphics.Dispose()

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()

Dim
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)

bufferGraphics.ReleaseHdc(bufferDC)
formGraphics.ReleaseHdc(formDC)

bufferGraphics.Dispose()
Dispose()
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.