I wonder how the screen recorder and screen capture application capture the window screen.?
As I know How to take Snapshot in this But the question is that their application were minimize/minimize to notify icons....
And by the one click: (F11) screen get capture...
I tried this.
Form1.hide()
notifyicon1.show()... etc etc/....
But i could not manage that When i am unfocus to the form then though How I can capture the screen:
My code to capture the Screen are below:
Public Class Snapshoter
Private Sub Snapshoter_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.F11 Then
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
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
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
Dim ask As MsgBoxResult
ask = MsgBox("Want to save image?", MsgBoxStyle.Question & MsgBoxStyle.YesNo, "DM.Question")
If ask = MsgBoxResult.Yes Then
SaveFileDialog1.ShowDialog()
Else
If ask = MsgBoxResult.No Then
PictureBox1.Visible = False
PictureBox1.Enabled = False
End If
End If
Me.Close()
End If
If e.KeyCode = Keys.F12 Then
Me.Close()
End If
End Sub
Private Sub Snapshoter_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MsgBox("Hotkeys:" & vbNewLine & "F11: Snapshot" & vbNewLine & "F12: Exit Snapshoter", MsgBoxStyle.OkOnly, "")
End Sub
Private Sub SaveFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
Dim FileToSaveAs As String = SaveFileDialog1.FileName
PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
End Sub
End Class