Вы находитесь на странице: 1из 2

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

______________
Like � Show 0

Вам также может понравиться