Prev: converting ansi to utf8 format - is there anything wrong with it ? urgently requires help
Next: DragImageBits
From: dgk on 7 Apr 2006 20:56 I'm trying to save the image of a webbrowser control. Not a particular image being shown on the page, but rather the visible display of the webbrowser. Using VS2005 I figured that maybe DrawToBitmap would work, but it appears that the webbrowser doesn't implement it. So I looked around and found that this code: Dim g As Graphics g.CopyFromScreen(Me.wb1.PointToScreen(New Point(0, 0)), New Point(0, 0), wb1.Size) should get the image into a graphics object. What I can't figure out is how to get that into a bitmap that I can hang on to. This: dim b as Bitmap = g.??? doesn't appear to be the correct approach; at least nothing works. Is there some way to do this or am I going about it wrong? I can use SnagIt or even PrintScreen to dump it into the clipboard so there must be some way to get at it. Any help greatly appreciated.
From: Cor Ligthert [MVP] on 8 Apr 2006 03:24 dgk, A image in a webpage (therefore as well in the webbrowser) has to be forever an image (or Java, Flash program or whatever related for web) as an url. Therefore working with bitmaps in a webbrowser is withouth any sense. You have to set the picture (url) too an absolute place in the browser or create first something as a table to fix it on its place. I hope this helps, Cor "dgk" <NoWhere(a)MailsAnonymous.com> schreef in bericht news:9e1e32hgu80me8q6q2k671rn8584k5p8u1(a)4ax.com... > I'm trying to save the image of a webbrowser control. Not a particular > image being shown on the page, but rather the visible display of the > webbrowser. Using VS2005 I figured that maybe DrawToBitmap would work, > but it appears that the webbrowser doesn't implement it. > > So I looked around and found that this code: > > Dim g As Graphics > g.CopyFromScreen(Me.wb1.PointToScreen(New Point(0, 0)), New > Point(0, 0), wb1.Size) > > should get the image into a graphics object. What I can't figure out > is how to get that into a bitmap that I can hang on to. This: > > dim b as Bitmap = g.??? > > doesn't appear to be the correct approach; at least nothing works. > > Is there some way to do this or am I going about it wrong? I can use > SnagIt or even PrintScreen to dump it into the clipboard so there must > be some way to get at it. Any help greatly appreciated.
From: Ken Tucker [MVP] on 8 Apr 2006 06:40 Hi, Dock the webbrowser control in a panel. Use the panels drawtobitmap method. Dim bmWb As New Bitmap(Panel1.Width, Panel1.Height) Panel1.DrawToBitmap(bmWb, Panel1.ClientRectangle) PictureBox2.Image = bmWb Ken ------------------- "dgk" <NoWhere(a)MailsAnonymous.com> wrote in message news:9e1e32hgu80me8q6q2k671rn8584k5p8u1(a)4ax.com... > I'm trying to save the image of a webbrowser control. Not a particular > image being shown on the page, but rather the visible display of the > webbrowser. Using VS2005 I figured that maybe DrawToBitmap would work, > but it appears that the webbrowser doesn't implement it. > > So I looked around and found that this code: > > Dim g As Graphics > g.CopyFromScreen(Me.wb1.PointToScreen(New Point(0, 0)), New > Point(0, 0), wb1.Size) > > should get the image into a graphics object. What I can't figure out > is how to get that into a bitmap that I can hang on to. This: > > dim b as Bitmap = g.??? > > doesn't appear to be the correct approach; at least nothing works. > > Is there some way to do this or am I going about it wrong? I can use > SnagIt or even PrintScreen to dump it into the clipboard so there must > be some way to get at it. Any help greatly appreciated.
From: Herfried K. Wagner [MVP] on 8 Apr 2006 18:44 "Cor Ligthert [MVP]" <notmyfirstname(a)planet.nl> schrieb: > A image in a webpage (therefore as well in the webbrowser) has to be > forever an image (or Java, Flash program or whatever related for web) as > an url. The OP wants to create a screenshot of the page being shown in the webbrowser control and save it to a bitmap, IMO. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
From: dgk on 8 Apr 2006 09:31 On Sat, 8 Apr 2006 06:40:07 -0400, "Ken Tucker [MVP]" <vb2ae(a)bellsouth.net> wrote: >Hi, > > Dock the webbrowser control in a panel. Use the panels drawtobitmap >method. > >Dim bmWb As New Bitmap(Panel1.Width, Panel1.Height) >Panel1.DrawToBitmap(bmWb, Panel1.ClientRectangle) > >PictureBox2.Image = bmWb > > >Ken That was clever but it doesn't work; all I get is a white screen. I then tried getting rid of the panel and using the form, but I get the whole form with a big white space where the webbrowser is. I guess that's why I was having so much trouble doing it straight; the webbrowser image is sort of outside the scope of the project. It appears that this is not going to be trivial. Any other ideas?
|
Next
|
Last
Pages: 1 2 3 4 Prev: converting ansi to utf8 format - is there anything wrong with it ? urgently requires help Next: DragImageBits |