And I found something else on StackOverflow that I didn’t know existed.
For this Stackoverflow user there seemed to be a problem when using CopyFromScreen.
I used to use the GDI+ version for this. Which this might well just be a wrapper for.
But for me this code works just fine.
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As EventArgs) Handles MyBase.Load
Dim screenSize = SystemInformation.PrimaryMonitorSize
Dim bitmap = New Bitmap(screenSize.Width, screenSize.Height)
Using g As Graphics = Graphics.FromImage(bitmap)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screenSize)
End Using
PictureBox1.Image = bitmap
bitmap.Save("c:tempscreenshot.png", Imaging.ImageFormat.Png)
End Sub
End Class
As you can see in this screenshot.
And the file is saved too.
So I don’t know what the problem is the user is having but I know it works ;-).