WebBrowser Oluşturucu

Tanım

WebBrowser sınıfının yeni bir örneğini başlatır.

C#
public WebBrowser ();

Özel durumlar

Denetim WebBrowser Internet Explorer'da barındırılır.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir.

C#
private void PrintHelpPage()
{
    // Create a WebBrowser instance. 
    WebBrowser webBrowserForPrinting = new WebBrowser();

    // Add an event handler that prints the document after it loads.
    webBrowserForPrinting.DocumentCompleted +=
        new WebBrowserDocumentCompletedEventHandler(PrintDocument);

    // Set the Url property to load the document.
    webBrowserForPrinting.Url = new Uri(@"\\myshare\help.html");
}

private void PrintDocument(object sender,
    WebBrowserDocumentCompletedEventArgs e)
{
    // Print the document now that it is fully loaded.
    ((WebBrowser)sender).Print();

    // Dispose the WebBrowser now that the task is complete. 
    ((WebBrowser)sender).Dispose();
}

Açıklamalar

Varsayılan olarak, WebBrowser denetim boş olur. İlk belgeye gitmek için özelliğini ayarlayın Url .

Şunlara uygulanır

Ürün Sürümler
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7