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
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:
should all be 1
As for the AnnotationMoved event not firing everytime.... that was in a bug in my code, so ignore that.
Who is online
Users browsing this forum: No registered users and 1 guest