ScrollRectIntoView method

Scrolls a specific rectangular region into view on the display.


HRESULT retVal = object.ScrollRectIntoView(pIElement, rect);


pIElement [in]

Type: IHTMLElement

A pointer to an IHTMLElement interface that specifies the scrollable region.

rect [in]

Type: RECT

A RECT structure that specifies the area to bring into view within the scrollable region of pIElement.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


The pIElement parameter resolves ambiguities if there is more than one scrolling element in a document. For example, if a document has a textArea element in the body element, set pIElement to the body element to scroll in relationship to the document window. If you set pIElement to the textArea element, the scrolling occurs in the scrollable region of the textArea.