Класс WpfAnnotatedImagePrintManager
 
            
                В этом разделе
            
            Обеспечивает функциональность для печати 
ImageCollection с аннотациями. Также класс позволяет использовать 
WpfThumbnailViewer для предварительного просмотра печати.
 
            
            
Объектная модель
Синтаксис
Пример
Вот C#/VB.NET код, который демонстрирует, как напечатать коллекцию изображений с аннотациями на принтере по умолчанию, каждое изображение из коллекции изображений будет напечатано в режиме BestFit:
    
	
	    
	    
''' <summary>
''' Prints the images on default printer.
''' </summary>
''' <param name="images">The images.</param>
Public Sub PrintImagesOnDefaultPrinter(images As Vintasoft.Imaging.ImageCollection)
    ' create data controller
    Dim dataController As New Vintasoft.Imaging.Annotation.AnnotationDataController(images)
    ' create print manager
    Dim imagePrintManager As New Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager(dataController)
    ' specify that each image must be resized to fit within the page margins,
    ' image proportions is not changed
    imagePrintManager.PrintScaleMode = Vintasoft.Imaging.Print.PrintScaleMode.BestFit
    ' subscribe to the PrintingProgress event
    AddHandler imagePrintManager.PrintingProgress, New System.EventHandler(Of Vintasoft.Imaging.ProgressEventArgs)(AddressOf imagePrintManager_PrintingProgress)
    ' start print
    imagePrintManager.Print("Print task title")
End Sub
''' <summary>
''' Printing is in progress.
''' </summary>
Private Sub imagePrintManager_PrintingProgress(sender As Object, e As Vintasoft.Imaging.ProgressEventArgs)
    ' if printing is started
    If e.Progress = 0 Then
        System.Console.Write("Printing: ")
    End If
    ' write the printing progress
    System.Console.Write(String.Format("{0} ", e.Progress))
    ' if printing is finished
    If e.Progress = 100 Then
        Dim imagePrintManager As Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager = DirectCast(sender, Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager)
        ' unsubscribe from the PrintingProgress event
        RemoveHandler imagePrintManager.PrintingProgress, New System.EventHandler(Of Vintasoft.Imaging.ProgressEventArgs)(AddressOf imagePrintManager_PrintingProgress)
    End If
End Sub
	     
	 
 
    
	
	    
	    
/// <summary>
/// Prints the images on default printer.
/// </summary>
/// <param name="images">The images.</param>
public void PrintImagesOnDefaultPrinter(Vintasoft.Imaging.ImageCollection images)
{
    // create data controller
    Vintasoft.Imaging.Annotation.AnnotationDataController dataController =
        new Vintasoft.Imaging.Annotation.AnnotationDataController(images);
    // create print manager
    Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager imagePrintManager =
        new Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager(dataController);
    // specify that each image must be resized to fit within the page margins,
    // image proportions is not changed
    imagePrintManager.PrintScaleMode = Vintasoft.Imaging.Print.PrintScaleMode.BestFit;
    // subscribe to the PrintingProgress event
    imagePrintManager.PrintingProgress +=
        new System.EventHandler<Vintasoft.Imaging.ProgressEventArgs>(imagePrintManager_PrintingProgress);
    // start print
    imagePrintManager.Print("Print task title");
}
/// <summary>
/// Printing is in progress.
/// </summary>
private void imagePrintManager_PrintingProgress(object sender, Vintasoft.Imaging.ProgressEventArgs e)
{
    // if printing is started
    if (e.Progress == 0)
        System.Console.Write("Printing: ");
    // write the printing progress
    System.Console.Write(string.Format("{0} ", e.Progress));
    // if printing is finished
    if (e.Progress == 100)
    {
        Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager imagePrintManager =
            (Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager)sender;
        // unsubscribe from the PrintingProgress event
        imagePrintManager.PrintingProgress -=
            new System.EventHandler<Vintasoft.Imaging.ProgressEventArgs>(imagePrintManager_PrintingProgress);
    }
}
	     
	 
 
 
Иерархия наследования
System.Object
   Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager
      Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager
 
Требования
Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
 
Смотрите также