I will be showing you how to take a screen shot with VB.NET
First you´ll need 2 Buttons and a picture box wich covers a big area
place the first button and rename it to "Take Screenshot", then add the code :
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 = screenshotthen place the second button, name it "Save", then add the code :
Dim savefiledialog1 As New SaveFileDialog Try savefiledialog1.Title = "Save File" savefiledialog1.FileName = "*.jpeg" savefiledialog1.Filter = "JPEG |*.jpeg" If savefiledialog1.ShowDialog() = DialogResult.OK Then PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp) End If Catch ex As Exception 'Do Nothing End Tryand at last add the picture box, make sure it covers a big area so that the screenshot will fit in.
Edited by WingedPanther, 07 May 2009 - 02:58 AM.


Sign In
Create Account


Back to top









