screen cap multi monitor problem

  • Thread starter Thread starter Smokey Grindel
  • Start date Start date
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!
 
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.
 
Back
Top