56 lines
1.8 KiB
VB.net
56 lines
1.8 KiB
VB.net
Public Class cProgramFunctions
|
|
|
|
Public Sub screenshot()
|
|
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")
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
|
|
Public Class MyListItem
|
|
Private mText As String
|
|
Private mValue As String
|
|
|
|
Public Sub New(ByVal pText As String, ByVal pValue As String)
|
|
mText = pText
|
|
mValue = pValue
|
|
End Sub
|
|
|
|
Public ReadOnly Property Text() As String
|
|
Get
|
|
Return mText
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Value() As String
|
|
Get
|
|
Return mValue
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides Function ToString() As String
|
|
Return mText
|
|
End Function
|
|
|
|
|
|
|
|
|
|
|
|
End Class |