1

EDIT: I try clientRectangle but I get the image from the left superior corner of the desktop and not of the form! I try to get a screenshot of my form where there is a flash animation. So I try this:

Rectangle bounds = this.Bounds;
Bitmap bitmap = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(bitmap);

g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
bitmap.Save("C:/Users/Public/Documents/YouCam/flash.jpeg", ImageFormat.Jpeg);
MessageBox.Show("Save");

It work, but I get also the border of the form with this. How can I get the inner of the form without the control bar and the borders? In red the zone that I want to capture:

enter image description here

Thanks ;)

PS: sorry form my poor english!

Gtazer
  • 11
  • 3

1 Answers1

0

You can use Form's method DrawToBitmap like that:

        Bitmap bitmap = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
        this.DrawToBitmap(bitmap, this.ClientRectangle);
        bitmap.Save(@"C:\Deployment\test.bmp");
fdafadf
  • 809
  • 5
  • 13
  • 1
    Did you test this? Because the user didn't want the borders. – LarsTech Sep 05 '18 at 18:35
  • Yes I try this but, drawtobitmap don't work with a flash animation! Only CopyFromScreen works. – Gtazer Sep 05 '18 at 20:03
  • @Gtazer Your question didn't mention anything about a flash animation. It's important to properly document your question. – LarsTech Sep 05 '18 at 20:11
  • Yes my bad sorry! So I want to capture my screen with a flash animation in! So I try clientRectangle but I get from the left superior deskop position... – Gtazer Sep 05 '18 at 20:19