1、封装 通过WebBrowser来生成截图
class WebPageBitmap {
WebBrowser MyBrowser;
string URL;
int Height;
int Width;
public WebPageBitmap(string url)
{
this.URL = url;
MyBrowser = new WebBrowser();
MyBrowser.ScrollBarsEnabled = false;
}
/// <summary>
/// 初始化网页
/// </summary>
public void GetIt()
{
MyBrowser.Navigate(this.URL);
while (MyBrowser.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
this.Height = int.Parse(MyBrowser.Document.Body.GetAttribute("scrollHeight"));
this.Width = int.Parse(MyBrowser.Document.Body.GetAttribute("scrollwidth"));
MyBrowser.Size = new Size(this.Width, this.Height);
}
/// <summary>
///