how to scroll WebBrowser

  • Thread starter Thread starter Zytan
  • Start date Start date
Please check this link:http://www.ben-rush.net/blog/PermaLink,guid,635eccfd-f33b-49f5-a351-0...
Let me know if you have any further problems.

Ben, thanks for the tip. I actuall figured it out over the weekend:

private void Scroll(WebBrowser webControl)
{
if (webControl.Document != null)
webControl.Document.Body.ScrollTop = int.MaxValue;
}

But, it seems to only work when you do:
webControl.Document.Write(s);
and not when you call this first, like MSDN asks you to:
webControl.Document.OpenNew(true);
this means that Write just appends. Since I'm just making a logger,
that's good enough! Why slow it down by reloading the entire thing,
when I can just append?

Also, to get a Document != null, you need to navigate somewhere first,
I choose about:blank

Zytan
 
Zytan,
Please check this link:http://www.ben-rush.net/blog/PermaLink,guid,635eccfd-f33b-49f5-a351-0...

Let me know if you have any further problems.

This method is the same as my method, and it doesn't work if the
webpage contains a DOCTYPE, which a conformant webpage should.
ScrollTop just stops working.

I need another solution, since I need a DOCTYPE so that the browser
knows to render the CSS as it is supposed to be rendered. The CSS
code "white-space:pre;" does not work without it.

Zytan
 
Back
Top