TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Roger Garrett
NA
9
21.4k
Capturing screen shot from webBrowser control in C#
Mar 21 2011 4:33 PM
I'm using the webBrowser control and trying to capture a screen shot from it. I start up the webBrowser control and set its URL to some web page. It displays just fine. Then, in response to a button press, I capture the image of the page that's contained within the webBrowser control, like this:
Bitmap bitmap = new Bitmap(webBrowser.Width, webBrowser.Height);
webBrowser.DrawToBitmap(bitmap, new Rectangle(0, 0, webBrowser.Width, webBrowser.Height));
And it does indeed get the page image and I can display it in a pictureBox control.
But a problem occurs when I click on a link in the displayed page and it goes to some other page. If I then click my "grab the page image" button, which again invokes the above code, the image that I get is completely white, even though the page is displayed properly within the webBrowser control.
If I stay on the initial web page I can repeatedly grab the image and display it. But whenever I go to some other subsequent page (which loads into the same webBrowser control) the image that gets grabbed is just plane white.
What do I have to do to get it to get the image from subsequently loaded pages?
Reply
Answers (
7
)
Number Truncation Issue With Exponential Numbers From Excel
Erase stuff from string