Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, January 19, 2009 1:55:17 PM(UTC)
JoeBussell

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?

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, January 19, 2009 1:58:27 PM(UTC)
JoeBussell

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)
Maen Hasan

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
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.058 seconds.