Me.Hide()
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
System.Threading.Thread.Sleep(200)
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)
screenshot.Save("img.jpg")
Me.Close()
---------
Me.Hide() hides the form momentarily to allow capturing complete screen including underneath of this form.
Code has been taken from some forum on Internet and added line 'screenshot.save("img.jpg")' so that capture image can be saved. Unless, path is specified, the image will be saved in the directory from where executable is run.
0 Comments