|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Save image of webbrowser control?How can I capture an image of a websession? Something like this where
wb1 is a webbrowser? Dim g As Graphics = wb1.CreateGraphics() Dim img As Bitmap = g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ) g.Dispose() I have no idea what to put in for the next argument in the CopyFrom Screen (the size) nor whether this is the way to go about it. I guess img = wb1.GetMeTheImage would be too easy. Hi,
Take a look at the drawtobitmap method of the webbrowser control http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx Ken -------------------- Show quoteHide quote "dgk" <NoWh***@MailsAnonymous.com> wrote in message news:69mr12t92c3fdcs5rj9jlr641tnt0r3o0f@4ax.com... > How can I capture an image of a websession? Something like this where > wb1 is a webbrowser? > > Dim g As Graphics = wb1.CreateGraphics() > Dim img As Bitmap = g.CopyFromScreen(New Point(0, 0), New Point(0, > 0), ) > g.Dispose() > > I have no idea what to put in for the next argument in the CopyFrom > Screen (the size) nor whether this is the way to go about it. I guess > img = wb1.GetMeTheImage would be too easy. On Sun, 19 Mar 2006 23:17:24 -0500, "Ken Tucker [MVP]"
<vb***@bellsouth.net> wrote: >Hi, Closer. But both bitmap and rectangle apparently need to be> > Take a look at the drawtobitmap method of the webbrowser control > >http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx > >Ken >-------------------- instantiated before the call. When I do that, I get a TargetBounds exception. Public Class Form1 Private MyImage As Bitmap = New Bitmap(150, 150) Private MyRectangle As New Rectangle Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load wb1.Navigate("www.google.com") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click wb1.DrawToBitmap(MyImage, MyRectangle) End Sub End Class Any idea how the rectangle should be created? |
|||||||||||||||||||||||