Avatar of DrowningTrout

asked on 

C# ScreenShot of Webbrowser

How do I take a screenshot of only my webbrowser1 that's within my C# program, I can successfully take a screenshot of the whole screen but not just the browser.

And how can I save the image as a Monochrome bitmap? (like in MS Paint)

Also, If I end up wanting to take a screenshot of the webbrowser while its minimized could I move it off the screen, un-minimize then take screenshot, move back?
bmpScreenshot = new Bitmap(webBrowser1.Bounds.Width, webBrowser1.Bounds.Height, PixelFormat.Format32bppRgb);
            gfxScreenshot = Graphics.FromImage(bmpScreenshot);
            gfxScreenshot.CopyFromScreen(webBrowser1.Bounds.X, webBrowser1.Bounds.Y, webBrowser1.Bounds.X, webBrowser1.Bounds.Y, webBrowser1.Bounds.Size, CopyPixelOperation.SourceCopy);
            bmpScreenshot.Save("Test.bmp", ImageFormat.Bmp);

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon