截取隐藏控件的屏幕截图

时间:2014-08-22 15:28:59

标签: vb.net bitmap webbrowser-control screenshot minimize

我想要做的就是能够截取控件的截图(在本例中为webbrowser),同时隐藏窗体最小化或webbrowser在后台。

我想把它当作一个使用计时器的位图,每次计时器滴答我想要拍摄该控件的图像位图。当控件位于顶部时,我能够做到这一点。

Private Function Screenshot(x1 as integer,x2 as integer,y1 as integer,y2 as integer) As Bitmap
    Dim bounds As Rectangle
    Dim screenshot As System.Drawing.Bitmap
    Dim graph As Graphics
    bounds = Screen.PrimaryScreen.Bounds
    screenshot = New System.Drawing.Bitmap(x1 - x2, y1- y2, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
    graph = Graphics.FromImage(screenshot)
    graph.CopyFromScreen(x1, y1, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
    Return screenshot
End Function

0 个答案:

没有答案