screen cap multi monitor problem

S

Smokey Grindel

I have a piece of code that takes a screen capture of what the user see's on
screen and stores it in memory as a bitmap

Public Shared Function TakeScreenCapture() As bitmap
Dim bounds As Rectangle = Screen.GetBounds(Point.Empty)
Dim bmp As Bitmap = New Bitmap(bounds.Width, bounds.Height)
Using g As Graphics = Graphics.FromImage(bmp)
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size)
Return bmp
End Using
End Function

the problem, if the user has multiple monitors, (2 in my tested case) this
does not work... any idea of how to take an image of each monitor or have
them all as one image? thanks!
 
A

Armin Zingler

Smokey said:
I have a piece of code that takes a screen capture of what the user see's on
screen and stores it in memory as a bitmap

Public Shared Function TakeScreenCapture() As bitmap
Dim bounds As Rectangle = Screen.GetBounds(Point.Empty)
Dim bmp As Bitmap = New Bitmap(bounds.Width, bounds.Height)
Using g As Graphics = Graphics.FromImage(bmp)
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size)
Return bmp
End Using
End Function

the problem, if the user has multiple monitors, (2 in my tested case) this
does not work... any idea of how to take an image of each monitor or have
them all as one image? thanks!

System.Windows.Forms.Screen.AllScreens returns all screens, so you can pass
screen.bounds.location to CopyFromScreen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top