LEADTOOLS Support
Document
Document SDK Questions
Re: Trouble with position information for line annotations in 14.5
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, January 19, 2009 1:55:17 PM(UTC)
Groups: Registered
Posts: 15
I have code which serializes my annotations to a data base. I store the annotation position based on the results of a query to the objects position. I have had some issues with line annotations where they do not report the same values for the end points that they were defined with. Considering the following snippet I do not believe that the message box should trigger, but it always does:
Public Sub DrawLine(hObj As OLE_HANDLE, startX As Single, startY As Single, endX As Single, endY As Single, Optional Clr As Variant)
Dim hObj As OLE_HANDLE
hObj = canvas.AnnCreate(ANNOBJECT_LINE, True, True)
Dim I As Integer
Dim J As Integer
Dim currTag As Integer
Dim swap As Integer
Dim ModeWas As Single
ModeWas = canvas.AnnUserMode
canvas.AnnUserMode = ANNUSERMODE_DESIGN
Dim startCX As Single, startCY As Single, endCX As Single, endCY As Single
canvas.BitmapToClient startX, startY
startCX = canvas.ConvertX
startCY = canvas.ConvertY
canvas.AnnDefine hObj, canvas.ConvertX, canvas.ConvertY, ANNDEFINE_BEGINSET
canvas.BitmapToClient endX, endY
endCX = canvas.ConvertX
endCY = canvas.ConvertY
canvas.AnnDefine hObj, canvas.ConvertX, canvas.ConvertY, ANNDEFINE_END
canvas.AnnSetVisible hObj, True, 0, ""
canvas.AnnUserMode = ModeWas
If Not IsMissing(Clr) Then
canvas.AnnSetForeColor hObj, CLng(Clr), False
End If
Dim arrX As Variant
Dim arrY As Variant
Dim loc1 As PointDB
Dim loc2 As PointDB
arrX = canvas.AnnGetPointX(hObj)
arrY = canvas.AnnGetPointY(hObj)
loc1.X = arrX(0)
loc1.y = arrY(0)
loc2.X = arrX(1)
loc2.y = arrY(1)
If ((startX <> loc1.X) Or (startY <> loc1.y) Or (endX <> loc2.X) Or (endY <> loc2.y)) Then
MsgBox "Not the same values: " & startX & " <> " & loc1.X & ") Or (" & startY & " <> " & loc1.y & ") Or (" & endX & " <> " & loc2.X & ") Or (" & endY & " <> " & loc2.y & ")"
End If
End Sub
Is there some trick to keeping these annotations from walking slightly up and left?
#2
Posted
:
Monday, January 19, 2009 1:58:27 PM(UTC)
Groups: Registered
Posts: 15
the hObj as an argument is a left over, not germane to the question
#3
Posted
:
Tuesday, January 20, 2009 4:56:56 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
I'm not sure what causes the shift you're getting, but before going into details, why not try a different approach.
Instead of parsing the object properties yourself, you could store the annotations into a memory buffer using the AnnSaveArray or AnnSaveMemory methods. You can then store it into the database.
If this approach will not work for you, can you put your code in a small test project (not your full application) and send it to us in a ZIP or RAR file and we will check it for you.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
LEADTOOLS Support
Document
Document SDK Questions
Re: Trouble with position information for line annotations in 14.5
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.