Monday, November 09, 2009 8:20 PMI am working on a program, and i have it taking a screenshot. Im trying to get it ONLY to take it of a certain area of the screen. I dont know how to do that. Here is the code right now.
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 Dim SaveFileDialog1 As New SaveFileDialog() SaveFileDialog1.Filter = "PNG|*.png|GIF|*.gif" If SaveFileDialog1.ShowDialog() = DialogResult.OK Then If Not PictureBox1.Image Is Nothing Then PictureBox1.Image.Save(SaveFileDialog1.FileName) End If End If