0

I want to capture the image of my webbrowser, or actually just a part of it.

I already achieved it, but it just takes a screenshot of it instead of capturing the bitmap itself.

So when i use this technique and you drag another window above it, the window is also captured. (this is what I don't want.)

My code:

' 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

So I need to get the image of the 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
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Verhelst
  • 1,492
  • 2
  • 22
  • 46

1 Answers1

1

WebBrowser.DrawToBitmap(bitmap, rectangle)

Sam Axe
  • 33,313
  • 9
  • 55
  • 89