Set Annotation visible false

Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.

Moderator: Alex

Post Reply
MichaelHerrmanns
Posts: 17
Joined: Mon Jan 03, 2011 2:45 pm

Set Annotation visible false

Post by MichaelHerrmanns »

Hello,

I want to write a function to switch all annotations of a image to visible false or true.
For this I use this code:

Code: Select all

Dim images As ImageCollection = AnnotationViewer1.Images
        Dim annotations As AnnotationController = New AnnotationController(images)
        Dim imageIndex As Integer, annoIndex As Integer
        For imageIndex = 0 To images.Count - 1
            Dim imageAnnotations As AnnotationCollection = annotations(imageIndex)
            For annoIndex = 0 To imageAnnotations.Count - 1
                Debug.Print(imageAnnotations(annoIndex).Visible.ToString)

                imageAnnotations(annoIndex).Visible = Not imageAnnotations(annoIndex).Visible

            Next annoIndex
        Next imageIndex
But I must reload the image to see the annoations visible false/true.

Any idea

regards
Michael
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Set Annotation visible false

Post by Alex »

Hello Michael,

Your code has logical mistake - you need to use annotation controller associated with annotation viewer instead of creating new annotation controller.

Here is your code:

Code: Select all

Dim annotations As AnnotationController = New AnnotationController(images)
and here is correct code:

Code: Select all

Dim annotations As AnnotationController = annotationViewer1.Annotations
Best regards, Alexander
MichaelHerrmanns
Posts: 17
Joined: Mon Jan 03, 2011 2:45 pm

Re: Set Annotation visible false

Post by MichaelHerrmanns »

Hello Alex,

Thank you very much.

Now it is working.

Best regards

Michael
Post Reply