This document is archived and information here might be outdated. Recommended version. |
Create a polyline geometry object using the RubberBand.TrackNew method when a user click the mouse on the map control.
///<summary> ///Create a polyline geometry object using the RubberBand.TrackNew method when a user click the mouse on the map control. ///</summary> ///<param name="activeView">An ESRI.ArcGIS.Carto.IActiveView interface that will user will interace with to draw a polyline.</param> ///<returns>An ESRI.ArcGIS.Geometry.IPolyline interface that is the polyline the user drew</returns> ///<remarks>Double click the left mouse button to end tracking the polyline.</remarks> public ESRI.ArcGIS.Geometry.IPolyline GetPolylineFromMouseClicks(ESRI.ArcGIS.Carto.IActiveView activeView) { ESRI.ArcGIS.Display.IScreenDisplay screenDisplay=activeView.ScreenDisplay; ESRI.ArcGIS.Display.IRubberBand rubberBand=new ESRI.ArcGIS.Display.RubberLineClass(); ESRI.ArcGIS.Geometry.IGeometry geometry=rubberBand.TrackNew(screenDisplay, null); ESRI.ArcGIS.Geometry.IPolyline polyline=(ESRI.ArcGIS.Geometry.IPolyline)geometry; return polyline; }
'''<summary> '''Create a polyline geometry object using the RubberBand.TrackNew method when a user click the mouse on the map control. '''</summary> '''<param name="activeView">An ESRI.ArcGIS.Carto.IActiveView interface that will user will interace with to draw a polyline.</param> '''<returns>An ESRI.ArcGIS.Geometry.IPolyline interface that is the polyline the user drew</returns> '''<remarks>Double click the left mouse button to end tracking the polyline.</remarks> Public Function GetPolylineFromMouseClicks(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView) As ESRI.ArcGIS.Geometry.IPolyline Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay=activeView.ScreenDisplay Dim rubberBand As ESRI.ArcGIS.Display.IRubberBand=New ESRI.ArcGIS.Display.RubberLineClass Dim geometry As ESRI.ArcGIS.Geometry.IGeometry=rubberBand.TrackNew(screenDisplay, Nothing) Dim polyline As ESRI.ArcGIS.Geometry.IPolyline=CType(geometry, ESRI.ArcGIS.Geometry.IPolyline) Return polyline End Function