我有两个表格。
- 表格1包含我需要截图的内容
- 表格2包含绘图(这个表格总是在最上面,但是透明)。
我需要截取第一个表格的屏幕截图,而不使其置于表格2的上方,也不包括表格2的内容。
以下是我正在处理的内容,我正在尝试修复它。
Private Function TakeScreenShot(ByVal Control As Control) As Bitmap
Dim Screenshot As New Bitmap(Control.Width, Control.Height)
Control.DrawToBitmap(Screenshot, New Rectangle(0, 0, Control.Width, Control.Height))
Return Screenshot
End Function
该函数不能正常工作,因为Control.drawtoBitmap没有设置IMG的值。
IMG是空白的,并返回一个纯白色的图像。
调用该函数的方式如下:
TakeScreenShot(form1.webbrowser1).Save("c:\Screenshot.png",
System.Drawing.Imaging.ImageFormat.Png)
非常感谢您的帮助。