Hi Neil
After a lot of surfing around, I found the following example:
______________
Private Function ConstructOffset(pInPolyline As IPolyline, dOffset As Double) As IPolyline
Dim pConstructCurve As IConstructCurve
On Error GoTo ErrorHandler
If pInPolyline Is Nothing Or pInPolyline.IsEmpty Then Exit Function
Set pConstructCurve = New Polyline
pConstructCurve.ConstructOffset pInPolyline, dOffset, esriConstructOffsetRounded + esriConstructOffsetSimple
Set ConstructOffset = pConstructCurve
Exit Function
ErrorHandler:
Set ConstructOffset = Nothing
End Function
______________
Here is my line drawing function. I can't get my function to correctly call the above function. Can you see what is wrong?
Many thanks
______________
Private Function DrawLine(x1, y1, x2, y2, aView As IActiveView, pMap, LineName)
On Error GoTo err_handler
Dim pPointCollection As IPointCollection
Dim pFromPoint As ipoint
Dim pToPoint As ipoint
Dim pPolyline As IPolyline
Set pFromPoint = New Point
Set pToPoint = New Point
Dim pLineSym As ISimpleLineSymbol
Dim pLineElement As ILineElement
pFromPoint.PutCoords x1, y1
pToPoint.PutCoords x2, y2
Set pPolyline = New Polyline
Set pPointCollection = New Polyline
Set oPointCollection = New Polyline
pPointCollection.AddPoint pFromPoint
pPointCollection.AddPoint pToPoint
Dim pGC As IGraphicsContainer
Set pGC = pMap
Dim pElement As IElement
Dim oElement As IElement
Dim oLineElement As ILineElement
Set pElement = New LineElement
Set oElement = New LineElement
pElement.Geometry = pPointCollection
Dim oLineSym As ISimpleLineSymbol
Dim SymCol As IRgbColor
Set pLineElement = pElement
Set oLineElement = oElement
Set pLineSym = New SimpleLineSymbol
pLineSym.Style = esriSLSSolid
pLineSym.Width = 3
Set SymCol = New RgbColor
SymCol.Blue = 255
pLineSym.Color = SymCol
pLineElement.Symbol = pLineSym
oLineElement = ConstructOffset(pPointCollection, 100)
Dim elemProps As IElementProperties
Set elemProps = pLineElement
elemProps.Name = LineName
pGC.AddElement pLineElement, 0
pGC.AddElement oLineElement, 0
aView.PartialRefresh esriViewGraphics, Nothing, Nothing
Exit Function
err_handler:
MsgBox Err & " - " & Error$
Resume
End Function
______________