HtmlWindow.WindowFrameElement Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the frame element corresponding to this window.
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
Property Value
An HtmlElement corresponding to this window's FRAME
element. If this window is not a frame, it returns null
.
Examples
The following code example compares the SRC
attribute of frames in a FRAMESET
to the current location. If they are different, the frames are reset to their original URLs.
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
Remarks
When you retrieve a FRAME
element from the Frames collection, it returns an HtmlWindow. Call WindowFrameElement on this object if you need to access attributes of the underlying FRAME
element, such as the SRC
attribute.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기