HtmlElement.ScrollIntoView(Boolean) Yöntem

Tanım

Bu öğenin üst veya alt kenarı belgenin penceresiyle hizalanana kadar bu öğeyi içeren belge boyunca kaydırılır.

public:
 void ScrollIntoView(bool alignWithTop);
public void ScrollIntoView(bool alignWithTop);
member this.ScrollIntoView : bool -> unit
Public Sub ScrollIntoView (alignWithTop As Boolean)

Parametreler

alignWithTop
Boolean

ise true, nesnenin üst kısmı pencerenin en üstünde görüntülenir. ise false, nesnenin alt kısmı pencerenin alt kısmında görüntülenir.

Örnekler

Aşağıdaki kod örneği, ada göre bir öğe bulur ve sayfanın üst kısmı görünür sayfanın üst kısmıyla hizalı olacak şekilde sayfayı kaydırılır.

private void ScrollToElement(String elemName)
{
    if (webBrowser1.Document != null)
    {
        HtmlDocument doc = webBrowser1.Document;
        HtmlElementCollection elems = doc.All.GetElementsByName(elemName);
        if (elems != null && elems.Count > 0)
        {
            HtmlElement elem = elems[0];

            elem.ScrollIntoView(true);
        }
    }
}
Private Sub ScrollToElement(ByVal ElemName As String)
    If (WebBrowser1.Document IsNot Nothing) Then
        With WebBrowser1.Document
            Dim Elems As HtmlElementCollection = .All.GetElementsByName(ElemName)
            If (Not Elems Is Nothing And Elems.Count > 0) Then
                Dim Elem As HtmlElement = Elems(0)

                Elem.ScrollIntoView(True)
            End If
        End With
    End If
End Sub

Şunlara uygulanır

Ayrıca bkz.