G
GM
Hello,
I have visual studio 2005 on XP SP2.
I have a simple sample application using a webbrowser and 2 buttons.
Button1 loads the page
Button2 saves the screenshot
But for some reason the screenshot is always blank
Sample code:
--------------
Private Function CreateScreenshot(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
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(New Uri("http://www.hln.be/"))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim bm As Bitmap
bm = CreateScreenshot(WebBrowser1)
bm.Save("c:\temp\test.png", System.Drawing.Imaging.ImageFormat.Png)
End Sub
Any ideas?
I have visual studio 2005 on XP SP2.
I have a simple sample application using a webbrowser and 2 buttons.
Button1 loads the page
Button2 saves the screenshot
But for some reason the screenshot is always blank
Sample code:
--------------
Private Function CreateScreenshot(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
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(New Uri("http://www.hln.be/"))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim bm As Bitmap
bm = CreateScreenshot(WebBrowser1)
bm.Save("c:\temp\test.png", System.Drawing.Imaging.ImageFormat.Png)
End Sub
Any ideas?