VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
Связь между коллекциями данных аннотаций и коллекциями видов аннотаций в WPF
В этом разделе
Класс WpfAnnotationViewController хранит связи один к одному между одной AnnotationDataCollection из AnnotationDataController и одной WpfAnnotationViewCollection.

Класс WpfAnnotationViewController позволяет:
Вот C#/VB.NET код, который демонстрирует, как загрузить коллекцию изображений, добавить аннотацию к первому изображению, прожечь аннотацию на изображении и сохранить коллекцию изображений в новый файл:
// Create the image collection and add images to collection.
Vintasoft.Imaging.ImageCollection imageCollection = 
    new Vintasoft.Imaging.ImageCollection();
imageCollection.Add(@"D:\Images\AutoContrast.jpg");
imageCollection.Add(@"D:\Images\AutoColors.jpg");

// Create annotation controllers associated with image collection.
Vintasoft.Imaging.Annotation.AnnotationDataController annotationDataController = 
    new Vintasoft.Imaging.Annotation.AnnotationDataController(imageCollection);
Vintasoft.Imaging.Annotation.Wpf.UI.WpfAnnotationViewController wpfAnnotationViewController = 
    new Vintasoft.Imaging.Annotation.Wpf.UI.WpfAnnotationViewController(annotationDataController);

// Create a data of rectangle annotation.
Vintasoft.Imaging.Annotation.RectangleAnnotationData rectangleAnnotationData = 
    new Vintasoft.Imaging.Annotation.RectangleAnnotationData();
rectangleAnnotationData.Location = new System.Drawing.PointF(340, 150);
rectangleAnnotationData.Size = new System.Drawing.SizeF(220, 150);
// Create a view of rectangle annotation.
Vintasoft.Imaging.Annotation.Wpf.UI.WpfRectangleAnnotationView wpfRectangleAnnotationView = 
    new Vintasoft.Imaging.Annotation.Wpf.UI.WpfRectangleAnnotationView(rectangleAnnotationData);
// Add the rectangle annotation to the annotation controller.
wpfAnnotationViewController[0].Add(wpfRectangleAnnotationView);

// Burn annotation collection on the first image.
wpfAnnotationViewController.BurnAnnotationCollectionOnImage(0);

// Save image collection to TIFF file.
imageCollection.SaveSync(@"D:\ImageCollection.tif", true);
' Create the image collection and add images to collection.
Dim imageCollection As New Vintasoft.Imaging.ImageCollection()
imageCollection.Add("D:\Images\AutoContrast.jpg")
imageCollection.Add("D:\Images\AutoColors.jpg")

' Create annotation controllers associated with image collection.
Dim annotationDataController As New Vintasoft.Imaging.Annotation.AnnotationDataController(imageCollection)
Dim wpfAnnotationViewController As New Vintasoft.Imaging.Annotation.Wpf.UI.WpfAnnotationViewController(annotationDataController)

' Create a data of rectangle annotation.
Dim rectangleAnnotationData As New Vintasoft.Imaging.Annotation.RectangleAnnotationData()
rectangleAnnotationData.Location = New System.Drawing.PointF(340, 150)
rectangleAnnotationData.Size = New System.Drawing.SizeF(220, 150)
' Create a view of rectangle annotation.
Dim wpfRectangleAnnotationView As New Vintasoft.Imaging.Annotation.Wpf.UI.WpfRectangleAnnotationView(rectangleAnnotationData)
' Add the rectangle annotation to the annotation controller.
wpfAnnotationViewController(0).Add(wpfRectangleAnnotationView)

' Burn annotation collection on the first image.
wpfAnnotationViewController.BurnAnnotationCollectionOnImage(0)

' Save image collection to TIFF file.
imageCollection.SaveSync("D:\ImageCollection.tif", True)


Доступ к коллекциям аннотаций

Свойство WpfAnnotationViewController.Images позволяет получить коллекцию изображений, управляемую контроллером аннотаций. Доступ к коллекциям данных аннотаций можно получить с помощью свойства WpfAnnotationViewController.DataController. Доступ к коллекциям видов аннотаций можно получить через индексатор.