Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Activate the tool
- var documentBars = ((IDocument)ArcMap.Document).CommandBars;
- var cmdItem = documentBars.Find(new UIDClass { Value = ThisAddIn.IDs.PolylineTool });
- ArcMap.Application.CurrentTool = cmdItem;
- // The tool's OnMouseDown event
- protected override void OnMouseDown(MouseEventArgs arg)
- {
- var rubberBand = new RubberLineClass();
- var geometry = rubberBand.TrackNew(ArcMap.Document.ActiveView.ScreenDisplay, new SimpleLineSymbolClass { Color = new RgbColorClass { Red = 255 } });
- geometry.SpatialReference = ArcMap.Document.FocusMap.SpatialReference;
- if (!geometry.IsEmpty)
- {
- var container = (IGraphicsContainer)ArcMap.Document.FocusMap;
- container.AddElement(new LineElementClass { Geometry = geometry }, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement