HtmlWindow.ScrollTo Method (Point)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Moves the window to the specified coordinates.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public void ScrollTo(
	Point point
)

Parameters

point
Type: System.Drawing.Point

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

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.

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

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);
	}
}

.NET Framework
Available since 2.0
Return to top
Show: