Hello CodeCall Members!!
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 :
then place the second button, name it "Save", then add the code :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 = screenshot
and at last add the picture box, make sure it covers a big area so that the screenshot will fit in.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 Try


LinkBack URL
About LinkBacks





Reply With Quote





Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum