Click here to Skip to main content
15,894,955 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi All,
How do I capture screenshot except my active form ?. I'm using C# , help plz
Posted

1 solution

I made a from with one button and a pictureBox.

C#
void Button1Click(object sender, EventArgs e)
{
	Bitmap SS=Screenshot();
	pictureBox1.Image=SS;
	pictureBox1.SizeMode=PictureBoxSizeMode.Zoom;
}

private Bitmap Screenshot()
{
    this.Hide();
    Thread.Sleep(500);
    Bitmap screen = new Bitmap(SystemInformation.VirtualScreen.Width,
                                         SystemInformation.VirtualScreen.Height);
 
 
    Graphics g = Graphics.FromImage(screen);
 
 
    g.CopyFromScreen(SystemInformation.VirtualScreen.X,
                             SystemInformation.VirtualScreen.Y,
                             0, 0, screen.Size);
    g.Dispose();
 
    this.Show();
    return screen;
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900