• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 691
  • Last Modified:

Visual Basic Screen Capture, with know coordinates.

Hello,

 I am wondering if I can supply a manual set of coordinates of the X / Y location to capture from. Using this currently and works great for the whole screen, but want to supply the location of where to capture from manual coords that I can plug in. Thanks


Dim bounds As Rectangle
        Dim screenshot As System.Drawing.Bitmap
        Dim graph As Graphics
        bounds = Screen.PrimaryScreen.Bounds
        screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        graph = Graphics.FromImage(screenshot)
        graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
        Enhance_Performance.PictureBox1.Image = screenshot

Open in new window

0
Jack_Jones
Asked:
Jack_Jones
  • 3
1 Solution
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hi, the answer to your question is in your code, just change this line:
bounds = Screen.PrimaryScreen.Bounds

Open in new window


With:
bounds = New Rectangle(X, Y, Width, Height)

Open in new window

Where X and Y are your coordinates, and Width and Height the area to copy, what else do you need?
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Or maybe I'm over simplifying your question?...
0
 
Jack_JonesAuthor Commented:
It's dead on for the x, y, and does what I need it to. Thanks for the help. ;)
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Glad to help buddy!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now