Hi everybody.

I would like to know if its possible do dynamically manipulate the scrolling of a webpage in a WebBrowser control in my Form.

Either by a page loaded event or some other event.

Also if that is possible, can it be done without the control having scrollbars.

I have very little experience with C# and appreciate all and any advice given.

Recommended Answers

All 6 Replies

You can use the Broswer.Document.Window.ScrollTo() method to move the view to a point in the webpage. The following code scrolls to the bottom right of the page. You would need to use some logic to determine what point on the page you want to scroll to:

Point p = new Point(webBrowser1.Document.Window.Size);
    webBrowser1.Document.Window.ScrollTo(p);

Thank you for you answer, I am not able to put your advise to the test just yet, but I would just like to aknowledge your reply.

Appreciated, have a go when you can and post again if you have any problems

commented: Very helpful and to the poin answer +1

You helped me with this, it worked well, for scrolling to the correct position after a button press.

I'm highly delighted, thank you so much.

I'm currently researching how to have my forms WebBrowser check for page loaded events, and have them trigger the scroll.

I hope you wont mind if I come back with my tail between my legs.

Thank you once again.

For page loaded you want to check out the DocumentCompleted event, it fires when the webbrowser finishes loading the current page.

Ryshad, thank you once again I am so gratful for your help.

++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.