How can I programmatically create a screen shot of

2019-02-02 02:12发布

I want to be able to create a screen shot of a given Web site, but the Web site may be larger than can be viewed on the screen. Is there a way I can do this?

Goal is to do this with .NET in C# in a WinForms application.

7条回答
男人必须洒脱
2楼-- · 2019-02-02 03:15

This is the code for creating screenshot programatically:


using System.Drawing.Imaging;


int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);

查看更多
登录 后发表回答