How to make a simple screenshot taker

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts Page 1 of 1
Contributors
Vikhedgehog
VIP - Donator
VIP - Donator
Posts: 812
Joined: Fri Nov 05, 2010 6:24 pm

In this tutorial you will learn how to make a screenshot taker in Visual Basic 2008, I hope. lmao; The program will have a capture button, a save button and a picturebox. If the user presses the capture button the program will take a screenshot and place it in the picturebox. By pressing the save button the content in the picturebox (our screenshot) will be saved as a Bitmap image. You can also save it as a jpg file, but for that you will need to convert the screenshot first. cryer;
1. Double click the Capture button and write:
Code: Select all
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

2. Double click the Save button and write:
Code: Select all
Dim savefiledialog1 As New SaveFileDialog
        Try
            savefiledialog1.Title = "Save File"
            savefiledialog1.FileName = "*.bmp"
            savefiledialog1.Filter = "Bitmap |*.bmp"
            If savefiledialog1.ShowDialog() = DialogResult.OK Then
                PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
            End If
        Catch ex As Exception
            'If the program gets an error nothing should be done
        End Try
Finally, debug it! It should work now. If you get an error, let me know! I hope you understand now how to make a screenshot taker! dunnno;
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

Nice Tutorial!
http://www.megaapps.tk/
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

this has been done countless times but still Nice Tutorial
You can find me on Facebook or on Skype mihai_92b
3 posts Page 1 of 1
Return to “Tutorials”