'======================================================= ' getPolygon '======================================================= Function getPolygon(x, y) As ipolygon Dim h, w, x1, y1 Dim text Set getPolygon = New Polygon Set this.a.IPointCollection = getPolygon Set this.a.IPoint = New Point h = 10 w = 10 x1 = x - (w / 2) y1 = y - (h / 2) Set this.a.IActiveView = this.a.IMxDocument.FocusMap Set this.a.IScreenDisplay = this.a.IActiveView.ScreenDisplay Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1, y1) this.a.IPointCollection.AddPoint this.a.IPoint Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1 + w, y1) this.a.IPointCollection.AddPoint this.a.IPoint Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1 + w, y1 + h) this.a.IPointCollection.AddPoint this.a.IPoint Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1, y1 + h) this.a.IPointCollection.AddPoint this.a.IPoint getPolygon.Close End Function '======================================================= ' getPolyline '======================================================= Public Function getPolyline(x, y) As ipolyline Dim h, w, x1, y1 Dim text Set getPolyline = New Polyline Set this.a.IPointCollection = getPolyline Set this.a.IPoint = New Point h = 10 w = 10 x1 = x - (w / 2) y1 = y - (h / 2) Set this.a.IActiveView = this.a.IMxDocument.FocusMap Set this.a.IScreenDisplay = this.a.IActiveView.ScreenDisplay Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1, y1) this.a.IPointCollection.AddPoint this.a.IPoint Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1 + w, y1) this.a.IPointCollection.AddPoint this.a.IPoint Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1 + w, y1 + h) this.a.IPointCollection.AddPoint this.a.IPoint Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x1, y1 + h) this.a.IPointCollection.AddPoint this.a.IPoint End Function '======================================================= ' DrawPolygon '======================================================= Public Function drawPolygon(ipolygon As ipolygon) Set this.a.IActiveView = this.a.IMxDocument.FocusMap Set this.a.IScreenDisplay = this.a.IActiveView.ScreenDisplay Set this.a.IFillSymbol = New simpleFillSymbol this.a.IFillSymbol.Color = this.Color.Esri("Tomato") this.a.IScreenDisplay.StartDrawing this.a.IScreenDisplay.hDC, esriNoScreenCache this.a.IScreenDisplay.SetSymbol this.a.IFillSymbol this.a.IScreenDisplay.drawPolygon ipolygon this.a.IScreenDisplay.FinishDrawing End Function '======================================================= ' DrawText '======================================================= Public Function drawText(x, y, text) Set this.a.ITextsymbol = New textSymbol Set this.a.IFontDisp = New StdFont this.a.IFontDisp.Name = "Arial" ' some value is required this.a.IFontDisp.size = 12 ' any value is required here this.a.IFontDisp.Underline = True this.a.ITextsymbol.Font = this.a.IFontDisp this.a.ITextsymbol.size = 12 this.a.ITextsymbol.Angle = 45 this.a.ITextsymbol.RightToLeft = False this.a.ITextsymbol.VerticalAlignment = esriTextVerticalAlignment.esriTVABaseline this.a.ITextsymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHAFull Set this.a.IActiveView = this.a.IMxDocument.FocusMap Set this.a.IScreenDisplay = this.a.IActiveView.ScreenDisplay Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x, y) this.a.IScreenDisplay.StartDrawing this.a.IScreenDisplay.hDC, esriNoScreenCache this.a.IScreenDisplay.SetSymbol this.a.ITextsymbol this.a.IScreenDisplay.drawText this.a.IPoint, text this.a.IScreenDisplay.FinishDrawing End Function '======================================================= ' DrawSymbol '======================================================= Public Function drawSymbol(x, y) Dim arrow As IArrowMarkerSymbol Set this.a.IArrowMarkerSymbol = New ArrowMarkerSymbol this.a.IArrowMarkerSymbol.Angle = 90 this.a.IArrowMarkerSymbol.size = 10 this.a.IArrowMarkerSymbol.XOffset = 0 this.a.IArrowMarkerSymbol.YOffset = 0 this.a.IArrowMarkerSymbol.Length = 10 Set this.a.IActiveView = this.a.IMxDocument.FocusMap Set this.a.IScreenDisplay = this.a.IActiveView.ScreenDisplay Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x, y) this.a.IScreenDisplay.StartDrawing this.a.IScreenDisplay.hDC, esriNoScreenCache this.a.IScreenDisplay.SetSymbol this.a.IArrowMarkerSymbol this.a.IScreenDisplay.DrawPoint this.a.IPoint this.a.IScreenDisplay.FinishDrawing End Function '======================================================= ' DrawPolyline '======================================================= Public Function drawPolyline(ipolyline As ipolyline) Dim arrow As IArrowMarkerSymbol Set this.a.ICartographicLineSymbol = New CartographicLineSymbol this.a.ICartographicLineSymbol.width = 1 this.a.ICartographicLineSymbol.Cap = esriLCSSquare this.a.ICartographicLineSymbol.Join = esriLJSMitre this.a.ICartographicLineSymbol.Color = this.Color.Esri("Blue") Set this.a.IActiveView = this.a.IMxDocument.FocusMap Set this.a.IScreenDisplay = this.a.IActiveView.ScreenDisplay Set this.a.IPoint = this.a.IScreenDisplay.DisplayTransformation.ToMapPoint(x, y) this.a.IScreenDisplay.StartDrawing this.a.IScreenDisplay.hDC, esriNoScreenCache this.a.IScreenDisplay.SetSymbol this.a.ICartographicLineSymbol this.a.IScreenDisplay.drawPolyline ipolyline this.a.IScreenDisplay.FinishDrawing End Function '======================================================= ' Cursor '======================================================= Public Property Let Cursor(ByVal value As Variant) Set this.a.ImouseCursor = New MouseCursor this.a.ImouseCursor.SetCursor value End Property