편집

다음을 통해 공유


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)

Moves the window to the specified coordinates.

public:
 void ScrollTo(System::Drawing::Point point);
public void ScrollTo (System.Drawing.Point point);
member this.ScrollTo : System.Drawing.Point -> unit
Public Sub ScrollTo (point As 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.

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);
    }
}
Dim ResizableWindow As HtmlWindow

Private Sub ResizeWindow()
    If (WebBrowser1.Document IsNot Nothing) Then
        ResizableWindow = WebBrowser1.Document.Window.OpenNew(New Uri("http://www.microsoft.com/"), "")
        ResizableWindow.ResizeTo(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)
    End If
End Sub

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

ScrollTo(Int32, Int32)

Scrolls the window to the designated position.

public:
 void ScrollTo(int x, int y);
public void ScrollTo (int x, int y);
member this.ScrollTo : int * int -> unit
Public Sub ScrollTo (x As Integer, y As Integer)

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