AnnGetDistance2 example for Visual Basic
Private Sub ExampleAnnGetDistance2(hObject As Long)
Dim ObjectType As AnnObjectType
Dim Count As Long
Dim TotalDistnation As Double
Dim TotalRulerUnit As Long
Dim TotalSmartUnit As Long
Dim Distance As Double
Dim RulerUnit As Long
Dim SmartUnit As Long
Dim szResult As String
RasterAnn.AnnGetType hObject
ObjectType = RasterAnn.AnnType
If ObjectType <> ANN_OBJECT_RULER Then
MsgBox "This Object is not an RULER Object"
End If
RasterAnn.AnnGetDistance2 hObject
Count = RasterAnn.DistanceCount
TotalDistance = RasterAnn.TotalDistance
TotalRulerUnit = RasterAnn.TotalRulerUnit
TotalSmartUnit = RasterAnn.TotalSmartUnit
szResult = "Total Distance = " + Str(TotalDistance) + Chr$(13) + _
"Total Ruler Unit = " + Str(TotalRulerUnit) + Chr$(13) + _
"Total Smart Unit = " + Str(TotalSmartUnit)
MsgBox szResult
For i = 0 To Count - 1
Distance = RasterAnn.Distance(i)
RulerUnit = RasterAnn.RulerUnit(i)
SmartUnit = RasterAnn.SmartUnit(i)
szResult = "Distance Index = " + Str(i) + Chr$(13) + _
"Distance = " + Str(Distance) + Chr$(13) + _
"Ruler Unit = " + Str(RulerUnit) + Chr$(13) + _
"Smart Unit = " + Str(SmartUnit)
MsgBox szResult
Next i
End Sub