WebBrowser.Print Metoda

Definicja

Drukuje dokument aktualnie wyświetlany w kontrolce WebBrowser przy użyciu bieżących ustawień drukowania i strony.

public:
 void Print();
public void Print ();
member this.Print : unit -> unit
Public Sub Print ()

Przykłady

W poniższym przykładzie kodu pokazano, jak za pomocą Print metody zaimplementować przycisk Drukuj dla WebBrowser kontrolki podobnej do tej w programie Internet Explorer. Ten przykład wymaga, aby formularz zawierał kontrolkę WebBrowser o nazwie webBrowser1 i kontrolkę Button o nazwie ButtonPrint.

// Prints the current document using the current print settings.
void ButtonPrint_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   this->WebBrowser1->Print();
}
// Prints the current document using the current print settings.
private void printButton_Click(object sender, EventArgs e)
{
    webBrowser1.Print();
}
' Prints the current document Imports the current print settings.
Private Sub printButton_Click( _
    ByVal sender As Object, ByVal e As EventArgs) _
    Handles printButton.Click

    webBrowser1.Print()

End Sub

Uwagi

Za pomocą tej metody można zaimplementować przycisk Drukuj podobny do tego w programie Internet Explorer. Ta metoda drukuje bieżący dokument bez konieczności dalszego wprowadzania danych przez użytkownika. Aby wyświetlić okno dialogowe Drukowanie przed drukowaniem, użyj ShowPrintDialog metody . Aby wyświetlić okno dialogowe Ustawienia strony , które umożliwia użytkownikom określanie wartości nagłówka i stopki oraz innych ustawień strony, użyj ShowPageSetupDialog metody . Aby wyświetlić okno dialogowe Podgląd wydruku , użyj ShowPrintPreviewDialog metody .

Dotyczy

Zobacz też