How To Make A Screen Shot Application In VB.NET


hello , your now in the right place to learn how to make a simple screen shot application vb.net as you can see lots of screen shot applications on the internet and they are very good and useful by the way i can write a tutorial about making a very advanced screen shot application with a lot features so i am now just going to teach you how to make a simple very small screen shot application in vb.net and this dont take too much time , ok now lets begin make a new project and name it and when the form loading finishes just adjust the regular things you do in the form properties and the application properties and after that make your form very small the size like 300,127 or however you want now add one button and a textbox and a timer from the toolbox after that simple change the button1 text to capture or whatever means capturing , make the textbox size 33,20 and inside the text of textbox1 add 5 and now click timer and go to properties and inside interval put 1000 , i will explain how the program will work after coding ends whne the program is running in the textbox you just need to add time like i mentioned add 5 now when you click the button capture it will go 4,3,2,1 and the application will hide itself in windows and the screen will be captured and saved near the executable of the application ,now make sure you have a good looking form also i dint mention before you can add a label to make the things look good




now coding time double click your form and add this code

Public Class Form1

    'Author : Mohamed Shimran
    'Blog : http://www.ultimateprogrammingtutorials.blogspot.com

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Enabled = False
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim snappit As String = 0
        TextBox1.Text -= snappit + 1
        If textbox1.text = 0 Then
            Me.Hide()
        End If
        If TextBox1.text = -2 Then
            Try
                Dim screenshot As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
                Dim screengrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
                Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screengrab)
                g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screenshot)
                screengrab.Save("snap.jpg")
                MsgBox("your screen has been snapped and the snap was saved", MsgBoxStyle.Information, "SuperScreenShot")
                Me.Close()
            Catch ex As Exception
                MsgBox("sorry unable to snap your screen and save at the moment please try again later", MsgBoxStyle.Critical, "Warning!")
            End Try
        End If
    End Sub
End Class

now debug the program and try it

2 comments

Thank you, works so fine!! Just not save the image in diferent location...

leonet@hotmail.com

Reply

Post a Comment

Note: Only a member of this blog may post a comment.