HtmlWindow.ScrollTo Method

Definition

Scrolls the window to the designated position.

Overloads

ScrollTo(Point)

Moves the window to the specified coordinates.

ScrollTo(Int32, Int32)

Scrolls the window to the designated position.

ScrollTo(Point)

Source:
HtmlWindow.cs
Source:
HtmlWindow.cs
Source:
HtmlWindow.cs

Moves the window to the specified coordinates.

C#
public void ScrollTo(System.Drawing.Point point);

Parameters

point
Point

The x- and y-coordinates, relative to the top-left corner of the current window, toward which the page should scroll.

Examples

The following code example scrolls through the document to the coordinate position clicked by the user.

C#
HtmlWindow resizableWindow = null;

private void ResizeWindow()
{
    if (webBrowser1.Document != null)
    {
        resizableWindow = webBrowser1.Document.Window.OpenNew(new Uri("http://www.microsoft.com/"), "");
        resizableWindow.ResizeTo(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
    }
}

Remarks

ScrollTo will cause the document to scroll so that the specified coordinate on the document is located in the upper-left corner of the document's window. If the document is not long or wide enough for this to happen, ScrollTo will scroll through the document as far as possible in the specified direction.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ScrollTo(Int32, Int32)

Source:
HtmlWindow.cs
Source:
HtmlWindow.cs
Source:
HtmlWindow.cs

Scrolls the window to the designated position.

C#
public void ScrollTo(int x, int y);

Parameters

x
Int32

The x-coordinate, relative to the top-left corner of the current window, toward which the page should scroll.

y
Int32

The y-coordinate, relative to the top-left corner of the current window, toward which the page should scroll.

Remarks

ScrollTo will cause the document to scroll so that the specified coordinate on the document is located in the upper-left corner of the document's window. If the document is not long or wide enough for this to happen, ScrollTo will scroll through the document as far as possible in the specified direction.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10