[Tut + Source] Screen Capture VB08

Posts 1–7 of 7 · Page 1 of 1
[Tut + Source] Screen Capture VB08
Here is a tutorial on how to make a screen capture. This program also allows you to save the picture to your computer.
1. Open up a new project and add 2 buttons,Savefiledialog,and a picturebox
2. Copy and paste
3. Press Thanks
Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        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
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        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

        End Try
    End Sub

End Class
When your done it should look like this. The screenshot will be the full width and height of your desktop

Here is download for the program
VIrus scan
Screen Capture by Steve.rarattachment deleted · 24 downloads before removal
cool. thx I was looking for 1 because none of the others work
i had one on my os simulator project :P pity how u cant make the preview smaller
Quote Originally Posted by luongoo View Post
i had one on my os simulator project :P pity how u cant make the preview smaller
ya I couldnt find a way how to but it doesn't really matter
doesnt windows have one built in? "print screen" lol but thx anyways
with hotkeys you could take multiple in a game and save them all and a lot of older computers don't have that button
most games now when you press printscreen it saves a different file everytime you press it.
and everybody that has a computer has a print screen on the keyboard. that was a while ago that it wasn't mainstream. in fact i have a keyboard from when i used windows 95 that even has it. :P and nobody has that old of a computer anymore that plays games.

but w/e, it helps beginners learn :P
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us