Originally Posted by
poedeltje
Good idea!
Hotkey is not hard to make, but screenshot is not easy :P.
Screenshot's are easy to do.
Sizeable SS
Code:
Form2.Hide()
Dim area As Rectangle
Dim capture As System.Drawing.Bitmap
Dim graph As Graphics
area = 'Insert area here. If you want to make it easier, make a semi transparent blank form and make the area Form2.Bounds
capture = New System.Drawing.Bitmap(Bounds.Width, Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(capture)
graph.CopyFromScreen(area.X, area.Y, 0, 0, area.Size, CopyPixelOperation.SourceCopy)
'Just handle capture now, like put it in a picture box and save it from there or do whatever you like.
Full Screen SS
Code:
'For this one, add a module in, name it whatever you'd like.
Public Class screenshot
Public Shared Image As Image
Public Shared Bounds As Rectangle
Shared Function GetDesktopImage(Optional ByVal Width As Integer = 0, Optional ByVal Height As Integer = 0, Optional ByVal ShowCursor As Boolean = True) As Image
Dim W As Integer = Screen.PrimaryScreen.Bounds.Width
Dim H As Integer = Screen.PrimaryScreen.Bounds.Height
Dim DesktopBitmap As New Bitmap(W, H)
Dim g As Graphics = Graphics.FromImage(DesktopBitmap)
g.CopyFromScreen(0, 0, 0, 0, New Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height), CopyPixelOperation.SourceCopy)
If ShowCursor Then Cursors.Default.Draw(g, New Rectangle(Cursor.Position, New Size(32, 32)))
g.Dispose()
If Width = 0 And Height = 0 Then
Image = DesktopBitmap
Return DesktopBitmap
Else
Dim ScaledBitmap As Image = DesktopBitmap.GetThumbnailImage(Width, Height, Nothing, IntPtr.Zero)
DesktopBitmap.Dispose()
Image = ScaledBitmap
Return ScaledBitmap
End If
End Function
End Class
'Use screenshot.GetDesktopImage To get a fullscreen ss. Then handle it how you'd like.
'Example: PictureBox1.Image = screenshot.GetDesktopImage