VintaSoft Imaging .NET SDK v8.7
In This Topic
    View thumbnails with annotations in WinForms
    In This Topic

    AnnotatedThumbnailViewer class, a WinForms control - inheritor of ThumbnailViewer class, is intended for viewing image thumbnails with annotations.

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


    Here is an example showing how to load images with annotations from file and display their thumbnails with annotations:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging.Annotation
    
    Private Sub LoadImagesWithAnnotation(annotatedThumbnailViewer As Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer, filename As String)
            annotatedThumbnailViewer.Images.Add(filename)
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging.Annotation
    
    void LoadImagesWithAnnotation(
        Vintasoft.Imaging.Annotation.UI.AnnotatedThumbnailViewer annotatedThumbnailViewer, string filename)
    {
        annotatedThumbnailViewer.Images.Add(filename);
    }
                    
    


    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 an example allowing to update the active image thumbnail only after annotation transformation is completed:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging.Annotation
    
    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
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging.Annotation
    
    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();
        }
    }