I am trying to take a screenshot with a form of a screen BUT I don't want my form to be included in the screenshot. This is my current Code for getting the screenshot.
Bitmap bt;
Graphics screenshot;
private void button1_Click_1(object sender, EventArgs e)
{
this.Opacity = 0;
bt = new Bitmap(Screen.FromControl(this).Bounds.Width, Screen.FromControl(this).Bounds.Height, PixelFormat.Format32bppArgb);
screenshot = Graphics.FromImage(bt);
screenshot.CopyFromScreen(Screen.FromControl(this).Bounds.X, Screen.FromControl(this).Bounds.Y, 0, 0, Screen.FromControl(this).Bounds.Size, CopyPixelOperation.SourceCopy);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = bt;
this.Opacity = 1;
}
This works to a degree, but the problem is that when I do this it causes the screen to flicker each time. Is there any way to make it so it doesn't include my form, but still takes everything behind it?