using DrawToBitmap on WebBrowser--works for some sites, not others

J

Joey

I want to use DrawToBitmap to generate a "thumbnail" graphic
reflecting a particular web page. The following code successfully
generates a graphic of the web page being viewed in the WebBrowser
control *in some cases.* For example, loading http://www.ebay.fr works
correctly, but attempting to load http://www.ebay.com results in an
empty image.

Bitmap bitmap = new Bitmap(WebBrowser.Width, WebBrowser.Height);
WebBrowser.DrawToBitmap(bitmap, new Rectangle(new Point(),
WebBrowser.Size));
bitmap.Save(saveImagePath, ImageFormat.Png);
bitmap.Dispose();

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top