I am trying to capture a screenshot of a windows form application, but when I capture the screenshot I get the taskbar at the top and edges outsides of my application. I just want to capture a screenshot of the inner part of my application excluding the outer edge outside of my application and the taskbar. Here is the code I am using to create a screenshot of the application.
private void captureScreenshot()
{
Rectangle bounds = this.Bounds;
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
}
bitmap.Save("c:\\Users\\Brandon\\Downloads\\Test.jpg", ImageFormat.Jpeg);
}
}
I'm assuming that the bounds of the application is not exactly what I want to be screenshot to get the effect that I desire as it captures the taskbar and slightly outside the edge of my application.
Here is a picture of the screenshot I am getting:
Here is a picture of the area that I would like to screenshot (outlined in yellow) :