Results 1 to 6 of 6

Thread: [RESOLVED] [2005] Screenshot on coordinates...

  1. #1

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    Resolved [RESOLVED] [2005] Screenshot on coordinates...

    How can i make a screenshot at some specified coordinates, a rectangle coordinates?

    I want to make a screensot only to a part of the screen.

    Code:
            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)
    
            g.CopyFromScreen(New Point(0, 0), New Point(100, 100), ScreenSize)
            'screenGrab.Save("C:\screenGrab.bmp")
            screenGrab.Save("C:\screenGrab.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
    I have tried with this code but it's not working as i need. The rest of the screen it's black...
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2005] Screenshot on coordinates...

    in your .copyfromscreen instruction, you're specifying to copy the whole screen to a bitmap. the upperleftdestination point is 100, 100.

    so the first 100 pixels to the left + the first 100 pixels at the top are black, and the screen image is cropped. am i right?

    which part of the screen do you want to copy?

  3. #3

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    Re: [2005] Screenshot on coordinates...

    Yes you are right... this is a sample that i founded on the forums... and it's not what i desire!

    I want to make a screenshot at the top of the screen on the left side for about 100 pixels, a rectangle...

    How can i do this ?!
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2005] Screenshot on coordinates...

    g.CopyFromScreen(New Point(0, 0), New Point(0, 0), new Size(100, 100))

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2005] Screenshot on coordinates...

    i forgot to mention

    Dim screenGrab As New Bitmap(100, 100)

  6. #6

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    Re: [2005] Screenshot on coordinates...

    You're the man...

    Thanks alot for the help!
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width