WebBrowser.DocumentTitle 속성

정의

WebBrowser 컨트롤에 현재 표시된 문서의 제목을 가져옵니다.

public:
 property System::String ^ DocumentTitle { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
public string DocumentTitle { get; }
[<System.ComponentModel.Browsable(false)>]
member this.DocumentTitle : string
Public ReadOnly Property DocumentTitle As String

속성 값

현재 문서의 제목이거나, 문서가 로드되지 않는 경우 빈 문자열("")입니다.

특성

예외

WebBrowser 인스턴스가 더 이상 유효하지 않은 경우

내부 ActiveX IWebBrowser2 컨트롤에서 WebBrowser 인터페이스 구현에 대한 참조를 검색할 수 없는 경우

예제

다음 코드 예제를 사용 DocumentTitle 하는 방법에 설명 합니다 현재 문서의 제목으로 양식 제목 표시줄을 업데이트 하는 속성입니다. 이 예제에서는 폼에는 WebBrowser 이라는 컨트롤 webBrowser1합니다.

전체 코드 예제를 보려면 방법: Windows Forms 애플리케이션에 웹 브라우저 기능 추가합니다.

// Updates the title bar with the current document title.
void WebBrowser1_DocumentTitleChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   this->Text = WebBrowser1->DocumentTitle;
}
// Updates the title bar with the current document title.
private void webBrowser1_DocumentTitleChanged(object sender, EventArgs e)
{
    this.Text = webBrowser1.DocumentTitle;
}
' Updates the title bar with the current document title.
Private Sub webBrowser1_DocumentTitleChanged( _
    ByVal sender As Object, ByVal e As EventArgs) _
    Handles webBrowser1.DocumentTitleChanged

    Me.Text = webBrowser1.DocumentTitle

End Sub

설명

이 속성은 문서 제목 애플리케이션의 제목 표시줄에 표시 하려는 경우 예를 들어 유용 합니다. 현재 문서에 대해 정의된 제목이 없는 경우 이 속성은 문서 위치 및 파일 이름으로 설정됩니다.

컨트롤이 DocumentTitleChanged 새 문서로 이동할 때 제목 표시줄에서 제목을 WebBrowser 업데이트하는 이벤트를 처리합니다.

적용 대상

추가 정보