HtmlWindow.WindowFrameElement Vlastnost

Definice

Získá prvek rámce odpovídající tomuto okně.

public:
 property System::Windows::Forms::HtmlElement ^ WindowFrameElement { System::Windows::Forms::HtmlElement ^ get(); };
public System.Windows.Forms.HtmlElement WindowFrameElement { get; }
public System.Windows.Forms.HtmlElement? WindowFrameElement { get; }
member this.WindowFrameElement : System.Windows.Forms.HtmlElement
Public ReadOnly Property WindowFrameElement As HtmlElement

Hodnota vlastnosti

Odpovídá HtmlElement elementu FRAME tohoto okna. Pokud toto okno není rámec, vrátí null.

Příklady

Následující příklad kódu porovnává SRC atribut rámců v souboru s FRAMESET aktuálním umístěním. Pokud se liší, rámce se resetují na původní adresy URL.

private void ResetFrames()
{
    if (!(webBrowser1.Document == null)) 
    {
        HtmlElement frameElement = null;
        HtmlWindow docWindow = webBrowser1.Document.Window;

        foreach (HtmlWindow frameWindow in docWindow.Frames)
        {
            frameElement = frameWindow.WindowFrameElement;
            String originalUrl = frameElement.GetAttribute("SRC");

            if (!originalUrl.Equals(frameWindow.Url.ToString())) 
            {
                frameWindow.Navigate(new Uri(originalUrl));
            }
        }
    }
}
Private Sub ResetFrames()
    If (WebBrowser1.Document IsNot Nothing) Then
        Dim FrameElement As HtmlElement
        Dim DocWindow As HtmlWindow = WebBrowser1.Document.Window

        For Each FrameWindow As HtmlWindow In DocWindow.Frames
            FrameElement = FrameWindow.WindowFrameElement
            Dim OriginalUrl As String = FrameElement.GetAttribute("SRC")

            If (Not OriginalUrl.Equals(FrameWindow.Url.ToString())) Then
                FrameWindow.Navigate(New Uri(OriginalUrl))
            End If
        Next
    End If
End Sub

Poznámky

Když načtete FRAME prvek z Frames kolekce, vrátí .HtmlWindow Volání WindowFrameElement pro tento objekt, pokud potřebujete přístup k atributům základního FRAME prvku, jako SRC je atribut.

Platí pro

Viz také