VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
In This Topic
    View thumbnails with annotations in WinForms
    In This Topic
    AnnotatedThumbnailViewer class, a WinForms control derived from ThumbnailViewer class, is intended for viewing image
    thumbnails with annotations.

    AnnotatedThumbnailViewer class extends the functionality of ThumbnailViewer class and allows to:

    Here is C#/VB.NET code that shows how to load images with annotations from file and display their thumbnails with annotations:
    void LoadImagesWithAnnotation(
        Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer annotatedThumbnailViewer, string filename)
    {
        annotatedThumbnailViewer.Images.Add(filename);
    }
    
    Private Sub LoadImagesWithAnnotation(annotatedThumbnailViewer As Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer, filename As String)
        annotatedThumbnailViewer.Images.Add(filename)
    End Sub
    


    AnnotatedThumbnailViewer class can be used separately or together with AnnotationViewer class.

    If AnnotatedThumbnailViewer class is used separately then it just shows annotations on thumbnails.

    If AnnotatedThumbnailViewer class is used together with AnnotationViewer class then it shows annotations on thumbnails and, at the same time, performs simultaneous update of active image thumbnail in AnnotationViewer when annotations associated with the thumbnail are changing (new annotation is added, existing annotation is transformed, etc).


    To increase the application performance it is possible do not update the active image thumbnail after each change related with its annotations, but only after end of annotation transform, e.g. when the annotation rotating is entirely completed.
    Here is C#/VB.NET code that allows to update the active image thumbnail only after annotation transformation is completed:
    Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer _annotatedThumbnailViewer1 = 
        new Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer();
    Vintasoft.Imaging.Annotation.UI.AnnotationViewer _annottionViewer1 = 
        new Vintasoft.Imaging.Annotation.UI.AnnotationViewer();
    
    bool _isAnnotationBeginInit = false;
    bool _isAnnotationTransforming = false;
    bool _showAnnotationTransformationOnThumbnail = false;
    
    void annotationViewer1_AnnotationTransformingStarted(object sender, 
        Vintasoft.Imaging.Annotation.UI.VisualTools.AnnotationViewEventArgs e)
    {
        _isAnnotationTransforming = true;
        if (!_showAnnotationTransformationOnThumbnail)
        {
            _isAnnotationBeginInit = true;
            e.AnnotationView.Data.BeginInit();
        }
    }
    
    void annotationViewer1_AnnotationTransformingFinished(object sender, 
        Vintasoft.Imaging.Annotation.UI.VisualTools.AnnotationViewEventArgs e)
    {
        _isAnnotationTransforming = false;
        if (_isAnnotationBeginInit)
        {
            _isAnnotationBeginInit = false;
            e.AnnotationView.Data.EndInit();
        }
    }
    
    Private _annotatedThumbnailViewer1 As New Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer()
    Private _annottionViewer1 As New Vintasoft.Imaging.Annotation.UI.AnnotationViewer()
    
    Private _isAnnotationBeginInit As Boolean = False
    Private _isAnnotationTransforming As Boolean = False
    Private _showAnnotationTransformationOnThumbnail As Boolean = False
    
    Private Sub annotationViewer1_AnnotationTransformingStarted(sender As Object, e As Vintasoft.Imaging.Annotation.UI.VisualTools.AnnotationViewEventArgs)
        _isAnnotationTransforming = True
        If Not _showAnnotationTransformationOnThumbnail Then
            _isAnnotationBeginInit = True
            e.AnnotationView.Data.BeginInit()
        End If
    End Sub
    
    Private Sub annotationViewer1_AnnotationTransformingFinished(sender As Object, e As Vintasoft.Imaging.Annotation.UI.VisualTools.AnnotationViewEventArgs)
        _isAnnotationTransforming = False
        If _isAnnotationBeginInit Then
            _isAnnotationBeginInit = False
            e.AnnotationView.Data.EndInit()
        End If
    End Sub