捕获webbrowser控件的图像

时间:2011-09-15 16:16:45

标签: vb.net

我想捕获我的webbrowser的图像,或者实际上只是它的一部分。

我已经实现了它,但它只是截取它而不是捕获位图本身。

因此,当我使用此技术并在其上方拖动另一个窗口时,也会捕获窗口。 (这是我不想要的。)

我的代码:

' 1. Get the WebBrowsers bitmap.

    Dim bmp As New Bitmap(WebBrowser1.Width, WebBrowser1.Height)
    Dim BMPEndResult As Bitmap
    Dim graph As Graphics = Graphics.FromImage(bmp)
    Dim p As Point = Me.PointToScreen(WebBrowser1.Location)
    graph.CopyFromScreen(p.X, p.Y, 0, 0, bmp.Size)
    picDest.Image = bmp

所以我需要获取webbrowser的图像:

 - without the scrollbars if possible
 - Even if the window is minimized or in the task bar
 - Full webbrowser
 - and also if possible just a part of it, where I can specify the top, left, width and height

1 个答案:

答案 0 :(得分:1)

WebBrowser.DrawToBitmap(位图,矩形)

相关问题