HtmlWindowCollection 클래스

정의

다른 HtmlWindow 내에 포함된 창을 나타냅니다.

public ref class HtmlWindowCollection : System::Collections::ICollection
public class HtmlWindowCollection : System.Collections.ICollection
type HtmlWindowCollection = class
    interface ICollection
    interface IEnumerable
Public Class HtmlWindowCollection
Implements ICollection
상속
HtmlWindowCollection
구현

예제

다음 코드 예제는 프레임을 포함 하는 페이지 내의 각 문서를 검사 하 고 향후 조사에 대 한 각 페이지에서 모든 나가는 하이퍼링크의 테이블을 만듭니다.

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

설명

HTML 문서 구성 될 수 있습니다는 FRAMESET 정의 하는 여러 개의 고정 FRAME 자체 HTML 페이지를 포함 하는 각 개체입니다. 문서의 숫자를 포함할 수 있습니다 또는 IFRAME 다른 문서 내에서 임의로 배치할 수 있는 개체입니다. FRAME 개체 및 IFRAME 개체는 해당 최상위 수준에서 표시 됩니다는 HtmlWindowCollection, 형식의 요소를 포함 하는 HtmlWindow합니다.

HtmlWindowCollection 지원 된 IEnumerator 인터페이스 루프 구문에서 사용할 수 있도록 합니다. 또한를 통해 메서드 호출 또는 표준 배열 구문을 사용 하 여 컬렉션의 요소에 대 한 액세스를 허용 하는 항목 메서드를 정의 합니다.

새 windows를 만드는 경우는 Open 또는 OpenNew 메서드 및 포함 하는 이러한 windows에서 호스트 된 문서 FRAME 또는 IFRAME 이러한 요소에 표시 되는 요소는 HtmlWindowCollection 부모 페이지의 합니다.

프레임에 대 한 자세한 내용은 설명서를 참조 합니다 Frames 속성입니다.

속성

Count

컬렉션의 요소 수를 가져옵니다.

Item[Int32]

컬렉션 내의 프레임 위치를 지정하여 프레임 창을 검색합니다.

Item[String]

프레임의 이름을 지정하여 프레임 창을 검색합니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetEnumerator()

HtmlWindowCollection의 모든 요소에서 반복할 수 있는 열거자를 반환합니다.

GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

ICollection.CopyTo(Array, Int32)

특정 Array 인덱스부터 시작하여 컬렉션의 요소를 Array에 복사합니다.

ICollection.IsSynchronized

해당 컬렉션에 대한 액세스가 동기화되어 스레드로부터 안전하게 보호되는지를 나타내는 값을 가져옵니다.

ICollection.SyncRoot

컬렉션에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상

추가 정보