简体   繁体   中英

Taking screen shot of a (remote) web page programmatically

I'm trying to take screen shots of web pages programmatically. I may also require to take screen shots of full or partial page. Is there a way to do this?

This question seems to cover capturing web pages - including alternatives to WebBrowser.DrawToBitmap. I guess once you've got the full page as an image you can manipulate that to get the partial page shot

Check out webbrowser method

webBrowser1.DrawToBitmap(bitmap, bitmapRect);

for more complete example go here

您可以使用WebBrowser控件,并使用VB PrintForm控件来捕获输出。

Try this

Rectangle region = new Rectangle(0, 0, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);
using (Bitmap bitmap = new Bitmap(region.Width, region.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
using (Graphics bitmapGraphics = Graphics.FromImage(bitmap))
{
bitmapGraphics.CopyFromScreen(region.Left, region.Top, 0, 0, region.Size);
bitmap.Save("location");
}

Source : http://www.dotnetthoughts.net/2007/04/13/capture-screen-using-c-and-net-20/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM