ErrorMeldung -> Screenshot und SystemEnviroment wird mitgeschickt.

This commit is contained in:
2023-11-23 15:40:46 +01:00
parent 59add26515
commit a6f262304e
4 changed files with 204 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
Imports System.IO
Imports System.Drawing
Imports System.IO
Imports System.Net.Mail
Imports System.Text
Imports System.Windows.Forms
@@ -534,6 +535,35 @@ Public Class cProgramFunctions
End Function
Public Function MakeScreenshot()
Dim form As New Form
form = Form.ActiveForm
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = form.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)
' PictureBox1.Image = screenshot
If Not My.Computer.FileSystem.DirectoryExists(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Screenshots_" & My.Application.Info.AssemblyName & "\") Then
My.Computer.FileSystem.CreateDirectory(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Screenshots_" & My.Application.Info.AssemblyName & "\")
End If
Dim cnt As Integer = 1
Dim strname As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\Screenshots_" & My.Application.Info.AssemblyName & "\" & form.Name & "_" & Now.ToString("ddMMyyyy_HHmm_")
While System.IO.File.Exists(strname & cnt & ".bmp") : cnt += 1 : End While
screenshot.Save(strname & cnt & ".bmp")
Return strname & cnt & ".bmp"
End Function
Public Function TakeScreenShot(ByVal Control As Control) As Bitmap
Dim tmpImg As New Bitmap(Control.Width, Control.Height)
Using g As Graphics = Graphics.FromImage(tmpImg)
g.CopyFromScreen(Control.PointToScreen(New Point(0, 0)), New Point(0, 0), New Size(Control.Width, Control.Height))
End Using
Return tmpImg
End Function
End Class