HtmlWindow.WindowFrameElement プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文Public ReadOnly Property WindowFrameElement As HtmlElement
public HtmlElement WindowFrameElement { get; }
public: property HtmlElement^ WindowFrameElement { HtmlElement^ get (); }
/** @property */ public HtmlElement get_WindowFrameElement ()
このウィンドウの FRAME 要素に対応する HtmlElement。このウィンドウがフレームではない場合、null 参照 (Visual Basic では Nothing) を返します。
解説Frames コレクションから FRAME 要素を取得すると、HtmlWindow が返されます。基になる FRAME 要素の属性 (SRC 属性など) にアクセスする必要がある場合は、このオブジェクトに対して WindowFrameElement を呼び出します。
使用例FRAMESET に含まれるフレームの SRC 属性と現在の場所を比較するコード例を次に示します。これらが異なる場合、フレームは元の URL にリセットされます。
Private Sub ResetFrames() If (Not WebBrowser1.Document Is 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
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)); } } } }
.NET Framework のセキュリティ
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- HtmlWindow.WindowFrameElement プロパティのページへのリンク