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 » Mon Aug 22, 2011 3:22 pm

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: 1443
Joined: Thu Jul 10, 2008 2:21 pm

Re: Set Annotation visible false

Post by Alex » Tue Aug 23, 2011 12:49 pm

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 » Wed Nov 09, 2011 4:17 pm

Hello Alex,

Thank you very much.

Now it is working.

Best regards

Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest