Muss man aus der Anwendung heraus einen Screenshot erstellen, kann dieser Code das erledigen.
''' <summary>
''' Ermittelt die aktuelle Bildschirmgroesse
'''
''' Unter Location wird der Speicherort des Screenshots angegeben
''' incl. des Dateinamens angegeben
'''
''' </summary>
''' <param name="Location"></param>
''' <returns></returns>
''' <remarks></remarks>
Function ScreenToPicture(ByVal Location As String) As String
Try
Dim currentScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim ScreenToBitmap As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim gGraphics As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(ScreenToBitmap)
gGraphics.CopyFromScreen(New Point(0, 0), New Point(0, 0), currentScreenSize)
ScreenToBitmap.Save(Location)
Return Location
Catch ex As Exception
Return ex.Message
End Try
End Function
Kommentare zum Snippet