Screen Grab a Hidden Form

  • 13 years ago

    Hi all i was wondering wheather anyone could help me with doing a screen grab on a hidden form? i dont have a clue where to start!

    The idea is i have a form with a webbrowser control on it, the form is hidden and when i send a command to the form, for it to take a screen shot of the browser control and save it out as a JPEG.

    Could someone point me in the right direction please.

    i am using 2005

    Many Thanks


  • 13 years ago

     ok i got this far but this grabs the entire screen, i just want to grab an image from a .net web browser that is hidden behind another form.

        Dim ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
        Dim screenGrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
        Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenGrab)

         Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)
            screenGrab.Save("C:\screenGrab.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

        End Sub

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only 3 numbers of interest to a computer scientist: 1, 0 and infinity”