Header Banner
wonderhowto.mark.png
Gadget Hacks Next Reality Food Hacks Null Byte The Secret Yumiverse Invisiverse Macgyverisms Mind Hacks Mad Science Lock Picking Driverless

How to Capture Desktop Screen with VB.NET

Nov 9, 2014 07:36 AM
Nov 9, 2014 04:13 PM
Camera lens with a blue tinted glass element.

Hello there. Today I wanna share on how to create a screen capture program.

Requirement:

  1. VB.NET
  2. PictureBox
  3. 2 Buttons ( Save, Capture)
  4. Monitor to see what u are doing ....

Create a Windows Form ....

Drag a Picture Box Onto The Form

Drag 2 Buttons Unto The Form

NAMELY: Capture and Save

Code for Capture:

------------------------------------------------------------------------

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

Code for Save

------------------------------------------------------------------------

Dim sfd As New SaveFileDialog

If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then

PictureBox1.Image.Save(sfd.FileName.ToString)

End If

And Thats it .....

Please FEEL Free to comment if u have any problem or u spot an error

You already know how to use your phone. With Gadget Hacks' newsletter, we'll show you how to master it. Each week, we explore features, hidden tools, and advanced settings that give you more control over iOS and Android than most users even know exists.

Sign up for Gadget Hacks Weekly and start unlocking your phone's full potential.

Related Articles

Comments

No Comments Exist

Be the first, drop a comment!