Düzenle

Aracılığıyla paylaş


PrintControllerWithStatusDialog Class

Definition

Controls how a document is printed from a Windows Forms application.

public ref class PrintControllerWithStatusDialog : System::Drawing::Printing::PrintController
public class PrintControllerWithStatusDialog : System.Drawing.Printing.PrintController
type PrintControllerWithStatusDialog = class
    inherit PrintController
Public Class PrintControllerWithStatusDialog
Inherits PrintController
Inheritance
PrintControllerWithStatusDialog

Examples

The following code example shows how to create a new PrintController and assign it to the PrintController property. The example assumes that you have added the System.Drawing.Printing namespace to the class and that you have created a new instance of a PrintDocument as myDocumentPrinter.

void myPrint()
{
   if ( useMyPrintController )
   {
      myDocumentPrinter->PrintController = gcnew myControllerImplementation;
      if ( wantsStatusDialog )
      {
         myDocumentPrinter->PrintController =
            gcnew PrintControllerWithStatusDialog( myDocumentPrinter->PrintController );
      }
   }
   myDocumentPrinter->Print();
}
void myPrint() {
   if (useMyPrintController==true) {
      myDocumentPrinter.PrintController = new myControllerImplementation();     
      if (wantsStatusDialog==true) {
         myDocumentPrinter.PrintController =
           new PrintControllerWithStatusDialog(myDocumentPrinter.PrintController);
      }
   }
   myDocumentPrinter.Print();
}
Sub myPrint()
    If useMyPrintController = True Then
        myDocumentPrinter.PrintController = New myControllerImplementation()
        If wantsStatusDialog = True Then
            myDocumentPrinter.PrintController = _
               New PrintControllerWithStatusDialog(myDocumentPrinter.PrintController)
        End If
    End If
    myDocumentPrinter.Print()
End Sub

Remarks

This class implements a PrintController and adds a status dialog box. A print controller specifies how a PrintDocument is printed.

For a list of initial property values for an instance of the PrintControllerWithStatusDialog class, see the PrintControllerWithStatusDialog constructor.

For more information about printing with Windows Forms, see the System.Drawing.Printing namespace overview. If you want to print from a Windows Presentation Foundation application, see the System.Printing namespace.

Constructors

PrintControllerWithStatusDialog(PrintController, String)

Initializes a new instance of the PrintControllerWithStatusDialog class, wrapping the supplied PrintController and specifying a title for the dialog box.

PrintControllerWithStatusDialog(PrintController)

Initializes a new instance of the PrintControllerWithStatusDialog class, wrapping the supplied PrintController.

Properties

IsPreview

Gets a value indicating this PrintControllerWithStatusDialog is used for print preview.

IsPreview

Gets a value indicating whether the PrintController is used for print preview.

(Inherited from PrintController)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnEndPage(PrintDocument, PrintPageEventArgs)

Completes the control sequence that determines when and how to print a page of a document.

OnEndPrint(PrintDocument, PrintEventArgs)

Completes the control sequence that determines when and how to print a document.

OnStartPage(PrintDocument, PrintPageEventArgs)

Begins the control sequence that determines when and how to print a page of a document.

OnStartPrint(PrintDocument, PrintEventArgs)

Begins the control sequence that determines when and how to print a document.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also