HtmlWindow.Frames プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Web ページ内で定義されている各 FRAME 要素への参照を取得します。
public:
property System::Windows::Forms::HtmlWindowCollection ^ Frames { System::Windows::Forms::HtmlWindowCollection ^ get(); };
public System.Windows.Forms.HtmlWindowCollection Frames { get; }
public System.Windows.Forms.HtmlWindowCollection? Frames { get; }
member this.Frames : System.Windows.Forms.HtmlWindowCollection
Public ReadOnly Property Frames As HtmlWindowCollection
プロパティ値
ドキュメントのHtmlWindowCollectionオブジェクトとFRAME オブジェクトのIFRAME。
例
次のコード例では、フレームを含むページ内の各ドキュメントを検査し、後で検査するために各ページからすべての送信ハイパーリンクのテーブルを作成します。
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");
}
}
}
}
Dim LinksTable As Hashtable
Private Sub GetLinksFromFrames()
LinksTable = New Hashtable()
Dim FrameUrl As String
If (WebBrowser1.Document IsNot 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
注釈
FRAMEは、FRAMESET内で定義された一連のウィンドウです。
FRAME1 つのドキュメント内で複数のドキュメントをホストできます。 各FRAMEは、特定の行と列の幅を持つものとして定義され、FRAME内で定義されている他のFRAMESETに対するページ上の位置です。FRAMEの位置は固定されますが、ユーザーはマウス カーソルを使用してFRAMEを拡大または縮小することがあります。
IFRAMEはフレームに似ていますが、固定された位置に固定する必要はありません。
フレームには、Web ページ内で定義されているHtmlWindowまたはFRAMEごとに、IFRAMEのインスタンスが 1 つ含まれます。