VB.net捕获整个网页并保存成图像

时间:2011-11-03 07:24:08
【文件属性】:
文件名称:VB.net捕获整个网页并保存成图像
文件大小:816KB
文件格式:RAR
更新时间:2011-11-03 07:24:08
VB.net 网页 保存成图像 VB.net捕获整个网页并保存成图像有软件 Private Sub GetImage() If WebBrowser1.Document Is Nothing Then Return End If Try Dim scrollWidth As Integer Dim scrollHeight As Integer scrollHeight = WebBrowser1.Document.Body.ScrollRectangle.Height scrollWidth = WebBrowser1.Document.Body.ScrollRectangle.Width WebBrowser1.Size = New Size(scrollWidth, scrollHeight) Dim bm As New Bitmap(scrollWidth, scrollHeight) WebBrowser1.DrawToBitmap(bm, New Rectangle(0, 0, bm.Width, bm.Height)) Dim SaveAsName As String SaveAsName = Regex.Replace(textWebURL.Text, "(\\|\/|\:|\*|\?|\""|\<|\>|\|)?", "") bm.Save(SaveAsName & ".png", System.Drawing.Imaging.ImageFormat.Png) bm.Dispose() Catch ex As Exception MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally ' End Try buttonCapture.Enabled = True End Sub
【文件预览】:
WebCapture1b.zip
WebCapture.zip
CodeProject Capture Entire Web Page_ Free source code and programming help 2.png
CodeProject Capture Entire Web Page_ Free source code and programming help.htm
CodeProject Capture Entire Web Page_ Free source code and programming help 1.gif

网友评论

  • 不是想要的
  • 加载后可以捕获图像,但我的只要在网页上有操作后就不行了。
  • 还可以,不过不是自己想要的
  • 不错~简单易懂~
  • 多数网页抓不来啊,使用了ajax的不行
  • 这段代码好像有点问题。。。
  • 解决了我燃眉之急,谢谢
  • 不错~简单易懂~
  • 还可以,不过不是自己想要的
  • 嗯、可以直接使用,值得研究一下。