HtmlWindow.Frames プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

ドキュメントの FRAME オブジェクトおよび IFRAME オブジェクトの HtmlWindowCollection。

FRAME は、FRAMESET 内で定義される一連のウィンドウです。FRAME を使用すると、単一のドキュメント内に複数のドキュメントをホストできます。各 FRAME は、一定の行幅と列幅を持つものとして定義され、FRAMESET 内で定義される他の FRAME を基準として相対的にページ上に配置されます。ユーザーがマウス カーソルを使用して FRAME を拡大または縮小する場合はありますが、FRAME の位置は固定です。IFRAME はフレームと似ていますが、特定の位置に固定する必要があります。
フレームには、Web ページ内で定義されている各 FRAME または IFRAME に対して HtmlWindow のインスタンスが 1 つ含まれます。

フレームを含むページ内の各ドキュメントを調べ、今後の調査で使用するために、各ページから張られているすべてのハイパーリンクの表を作成するコード例を、次に示します。
Dim LinksTable As Hashtable Private Sub GetLinksFromFrames() LinksTable = New Hashtable() Dim FrameUrl As String If (Not WebBrowser1.Document Is Nothing) Then With WebBrowser1.Document Dim CurrentWindow As HtmlWindow = .Window If (CurrentWindow.Frames.Count > 0) Then For Each Frame As HtmlWindow In CurrentWindow.Frames FrameUrl = Frame.Url.ToString() Dim FrameLinksHash As New Hashtable() LinksTable.Add(FrameUrl, FrameLinksHash) For Each HrefElement As HtmlElement In Frame.Document.Links FrameLinksHash.Add(HrefElement.GetAttribute("HREF"), "Url") Next Next Else Dim DocLinksHash As New Hashtable() LinksTable.Add(.Url.ToString(), DocLinksHash) For Each HrefElement As HtmlElement In .Links DocLinksHash.Add(HrefElement.GetAttribute("HREF"), "Url") Next End If End With End If End Sub
private void GetLinksFromFrames() { Hashtable linksTable = new Hashtable(); string frameUrl; if (!(webBrowser1.Document == null)) { HtmlWindow currentWindow = webBrowser1.Document.Window; if (currentWindow.Frames.Count > 0) { foreach (HtmlWindow frame in currentWindow.Frames) { frameUrl = frame.Url.ToString(); Hashtable frameLinksHash = new Hashtable(); linksTable.Add(frameUrl, frameLinksHash); foreach (HtmlElement hrefElement in frame.Document.Links) { frameLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url"); } } } else { Hashtable docLinksHash = new Hashtable(); linksTable.Add(webBrowser1.Document.Url.ToString(), docLinksHash); foreach (HtmlElement hrefElement in webBrowser1.Document.Links) { docLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url"); } } } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlWindow.Frames プロパティを検索する場合は、下記のリンクをクリックしてください。

- HtmlWindow.Frames プロパティのページへのリンク