PrintDocument.PrintController Propriété

Définition

Obtient ou définit le contrôleur d'imprimante et guide le processus d'impression.

public:
 property System::Drawing::Printing::PrintController ^ PrintController { System::Drawing::Printing::PrintController ^ get(); void set(System::Drawing::Printing::PrintController ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.Printing.PrintController PrintController { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.PrintController : System.Drawing.Printing.PrintController with get, set
Public Property PrintController As PrintController

Valeur de propriété

PrintController qui guide le processus d'impression. La valeur par défaut est une nouvelle instance de la classe PrintControllerWithStatusDialog.

Attributs

Exemples

L’exemple de code suivant nécessite que vous ayez créé un instance de la PrintDocument classe nommée myPrintDocument. L’exemple crée une instance de la PrintController classe, l’affecte à la PrintController propriété de myPrintDocumentet imprime le document.

Utilisez les espaces de System.Drawing.Printing noms et System.Windows.Forms pour cet exemple.

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

Remarques

Un contrôleur d’impression guide le processus d’impression de plusieurs façons. Par exemple, pour imprimer un document, vous devez le convertir en objet Graphics . Un PrintController spécifie où dessiner le graphique dans une image pour un aperçu avant impression ou sur une imprimante pour imprimer réellement le document. Un contrôleur d’impression peut également spécifier s’il faut imprimer immédiatement un document ou attendre un intervalle spécifié.

S’applique à

Voir aussi