VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
In This Topic
    Annotation view in WinForms
    In This Topic
    The AnnotationView class is always created on the base of AnnotationData class and defines the annotation's visual appearance and the way the user may interact with annotation.
    Link between classes derived from AnnotationData and AnnotationView is registered using the AnnotationViewFactory.RegisterViewForAnnotationData method.

    As in the case with classes derived from AnnotationData class, the classes derived from AnnotationView class are divided into 3 types:
    AnnotationView class contains the AnnotationView.Data property, which allows to get reference to a linked instance AnnotationData class. Also AnnotationView class contains a set of properties similar to the properties of AnnotationData class, which allow to relay annotation's properties through AnnotationView.

    Here is C#/VB.NET code that shows how to create an instance of view for EllipseAnnotationData annotation:
    public static Vintasoft.Imaging.Annotation.UI.AnnotationView CreateViewForEllipseAnnotationData(
        Vintasoft.Imaging.Annotation.EllipseAnnotationData ellipseAnnotation)
    {
        return new Vintasoft.Imaging.Annotation.UI.EllipseAnnotationView(ellipseAnnotation);
    }
    
    Public Shared Function CreateViewForEllipseAnnotationData(ellipseAnnotation As Vintasoft.Imaging.Annotation.EllipseAnnotationData) As Vintasoft.Imaging.Annotation.UI.AnnotationView
        Return New Vintasoft.Imaging.Annotation.UI.EllipseAnnotationView(ellipseAnnotation)
    End Function
    


    Annotation bounding rectangles

    The visual appearance of annotation has several bounding rectangle types. The following types are used for solving various tasks related to correct drawing and interaction with annotation:

    Focus annotation in WinForms annotation viewer

    Every annotation may receive focus in the image viewer. When an annotation is focused there appears a selection rectangle around it, which can be transformed (scaled, mirrored, rotated) and the annotation will be transformed in proportion to the selection rectangle.

    The views for annotations, which are based on a set of points, in addition, may be transformed using points. When annotation is selected - all of its points become selected, the user may change the location of each point using dragging.

    Also the views for annotations, which are based on a set of points, support composite selection mode, which allows to transform annotation both using selection rectangle and using points.

    The selection/transformation mode of annotation, which are based on a set of points, may be changed using LineAnnotationViewBase.GripMode property.


    Build and transform annotation in WinForms annotation viewer

    AnnotationView.Builder property defines the interactive controller, which is used for annotation building.
    AnnotationView.Transformer property defines the interactive controller, which is used for annotation transformation.

    Also AnnotationView class has AnnotationView.InteractionController property which defines the currently used interactive controller.
    Detailed information about building and transformation of annotation can be found in article: Building and transformation of annotations in WinForms.


    Monitor the annotation state

    AnnotationView class provides events, which allow to monitor the annotation state:

    Annotation collection

    The AnnotationViewCollection class is always created on the base of AnnotationDataCollection class and represents a collection of annotation's views, which are linked with annotation data from AnnotationDataCollection.
    The AnnotationViewCollection class makes changes synchronously in its collection and in linked AnnotationDataCollection.
    The AnnotationViewCollection class provides the ability to add, remove, reorder, resort elements, transform to AnnotationView elements array, access to AnnotationDataCollection. Also AnnotationViewCollection class allows to: