Page 1 of 1

Annotation Bugs

Posted: Fri Apr 28, 2017 10:34 am
by mattewan

I have noticed a few bugs with the annotations implementation.

I am drawing an a rect box on a gdpicture viewer, then using code to place an annotion (rectangle) in that place, as well as lots of other annotations which make it look like that box is a container for all the other annotations.

I am handling the gdviewer.annotationMoved event, so that when I move that container annotation, i get the new position and move all the other annotations to the same location, making it look like the container annotation actually contains them.

When I use the following code in AnnotationMoved:

_lControls(id).labelObject.Left = _gdViewer.GetAnnotationFromIdx(AnnotationIdx).Left
_lControls(id).labelObject.Top = _gdViewer.GetAnnotationFromIdx(AnnotationIdx).Top - 0.2

_gdViewer.GetAnnotationFromIdx(AnnotationIdx).Top returns the center point on the moved annotation, not the top point. For example, if I move a 1 inch in height annotation to the top left cornet for the document, left will return 0 (or close to it) but top will return 0.5, not 0.

Also, AnnotationMoved doesn't fire everytime. If i continually move the annotation around, in 1 in every 5 or so the annotation moved event doesn't get raised.

I'm using the latest version of gdpicture12



Re: Annotation Bugs

Posted: Fri Apr 28, 2017 11:32 am
by mattewan
Just a follow up.

Actually both the left & top properties return the mid position. Here is a perfect way to reproduce:

Dim containerObject As GdPicture12.Annotations.AnnotationRectangleHighlighter
Dim left, top, width, height As Single
left = 1
top = 1
width = 1
height = 1
containerObject = gdTemplate.GetAnnotationManager.AddRectangleHighlighterAnnot(Color.LightBlue, left, top, width, height)

Debug.Print("Left: " & containerObject.Left)
Debug.Print("Top: " & containerObject.Top)
Debug.Print("Width: " & containerObject.Width)
Debug.Print("Height: " & containerObject.Height)

That will print the following output:

Left: 1.5
Top: 1.5
Width: 1
Height: 1

should all be 1

As for the AnnotationMoved event not firing everytime.... that was in a bug in my code, so ignore that.