// getting Width, Height and Number of rectangles from form Dim pMXDoc As IMxDocument Dim pEnv As IEnvelope Dim pGraCont As IGraphicsContainer Dim pRubberEnv As IRubberBand Dim pElem As IElement ' DIM Coordinates Dim EnvXMin As Double Dim EnvYMin As Double EnvXMin = 425419 EnvYMin = 6011500 ' QI for the MXDocument interface Set pMXDoc = ThisDocument ' QI for the IGraphicsContainerSelect interface on the document's activeview Set pGraCont = pMXDoc.ActiveView 'create new Envelope Set pEnv = New Envelope pEnv.YMin = EnvYMin pEnv.XMin = EnvXMin pEnv.Height = EnvHeight pEnv.Width = EnvWidth For i = 1 To Numbers ' Create a new EnvelopeElement and set its Geometry Set pElem = New RectangleElement pElem.geometry = pEnv 'Add the new element at Z order zero pGraCont.AddElement pElem, 0 ' Generate Offset for next rectangle pEnv.Offset (EnvWidth / 2), 0 Next i ' Refresh the activeview pMXDoc.ActiveView.Refresh
Dim pMXDoc As IMxDocument Dim pEnv As IEnvelope Dim pGraCont As IGraphicsContainer Dim pRubberEnv As IRubberBand Dim pElem As IElement ' QI for the MXDocument interface Set pMXDoc = ThisDocument ' QI for the IGraphicsContainerSelect interface on the document's activeview Set pGraCont = pMXDoc.ActiveView ' Create a new RubberEnvelope Set pRubberEnv = New RubberEnvelope ' Return a new Envelope from the tracker object using TrackNew Set pEnv = pRubberEnv.TrackNew(pMXDoc.ActiveView.screenDisplay, Nothing) ' Create a new EnvelopeElement and set its Geometry Set pElem = New RectangleElement pElem.geometry = pEnv 'Add the new element at Z order zero pGraCont.AddElement pElem, 0 ' Refresh the activeview pMXDoc.ActiveView.Refresh
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.