HtmlWindow.WindowFrameElement Proprietà

Definizione

Ottiene l'elemento frame corrispondente alla finestra corrente.

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

Valore della proprietà

Oggetto HtmlElement corrispondente all'elemento di FRAME questa finestra. Se la finestra corrente non è un frame, verrà restituito null.

Esempio

Nell'esempio di codice seguente viene confrontato l'attributo SRC dei frame in un FRAMESET oggetto con la posizione corrente. Se sono diversi, i fotogrammi vengono reimpostati sugli URL originali.

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

Commenti

Quando si recupera un FRAME elemento dalla Frames raccolta, restituisce un oggetto HtmlWindow. Chiamare WindowFrameElement su questo oggetto se è necessario accedere agli attributi dell'elemento sottostante FRAME , ad esempio l'attributo SRC .

Si applica a

Vedi anche