Problem Displaying Multiple Annotations in GDViewer

Discussions about annotation support.
Post Reply
myow
Posts: 10
Joined: Wed Mar 21, 2012 4:34 pm

Problem Displaying Multiple Annotations in GDViewer

Post by myow » Wed Mar 21, 2012 4:41 pm

I am using the trial version of GDPicture .Net. I am using the following code to add annotations programmatically to an image. It works and displays the first annotation added. But if the same code is executed a second time, the annotation manager has both annotations in it but the second one does not display in the GDViewer. I manually moved the first annotation added to a different location (so the second one would not be on top of the first one) before executing the code for the second time. Any help would be appreciated. The GdViewer GetAnnotationCount returns a value of 1 after adding the second annotation.

Code: Select all

        
        annotMgr = New AnnotationManager
        annotMgr.InitFromGdPictureImage(imageID)
        annotMgr.SelectPage(GdViewer1.CurrentPage)
        Dim rect As AnnotationRectangle = annotMgr.AddRectangleAnnot(Color.Red, Color.Red,
                CSng(oGdPictureImaging.GetWidthInches(imageID)) / 2,
                CSng(oGdPictureImaging.GetHeightInches(imageID)) / 2, 0.3, 0.1)
        annotMgr.Close()
        Me.GdViewer1.DisplayFromGdPictureImage(imageID)

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Problem Displaying Multiple Annotations in GDViewer

Post by Loïc » Wed Mar 21, 2012 5:38 pm

Hello,

Please try this:

Code: Select all

            Me.GdViewer1.SaveAnnotationsToPage()
            annotMgr = New AnnotationManager
            annotMgr.InitFromGdPictureImage(imageID)
            annotMgr.SelectPage(GdViewer1.CurrentPage)
            Dim rect As AnnotationRectangle = annotMgr.AddRectangleAnnot(Color.Red, Color.Red,
                    CSng(oGdPictureImaging.GetWidthInches(imageID)) / 2,
                    CSng(oGdPictureImaging.GetHeightInches(imageID)) / 2, 0.3, 0.1)
            annotMgr.Close()
            Me.GdViewer1.DisplayFromGdPictureImage(imageID)
           Me.GdViewer1.ReloadAnnotations()
           Me.GdViewer1.Redraw()
Hope this helps.

Loïc

myow
Posts: 10
Joined: Wed Mar 21, 2012 4:34 pm

Re: Problem Displaying Multiple Annotations in GDViewer

Post by myow » Wed Mar 21, 2012 6:14 pm

My documentation has the ReloadAnnotations method but the method does not exists on my GdViewer1 object. Was this method recent and maybe I am using an old version without it? I have version 8.2.0.3. Thanks.
Last edited by myow on Wed Mar 21, 2012 6:16 pm, edited 1 time in total.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Problem Displaying Multiple Annotations in GDViewer

Post by Loïc » Wed Mar 21, 2012 6:16 pm

I don't really know. Please ensure to use latest version, this method have been added recently.

Kind regards,

Loïc

myow
Posts: 10
Joined: Wed Mar 21, 2012 4:34 pm

Re: Problem Displaying Multiple Annotations in GDViewer

Post by myow » Wed Mar 21, 2012 6:50 pm

That fixed the problem. Thanks for the quick reply!

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Problem Displaying Multiple Annotations in GDViewer

Post by Loïc » Wed Mar 21, 2012 7:04 pm

you're welcome :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests