arcengine 画线

private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{

ILineElement pLineElement;

 IActiveView pActiveView;

IRgbColor pRgbColor;

IRubberBand pRubberBand;
ISimpleLineSymbol pSimpleLineSymbol;
IPolyline pPloyline;
pActiveView = axMapControl1.ActiveView;
pSimpleLineSymbol = new SimpleLineSymbolClass();
pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
pRgbColor = new RgbColorClass();
pRgbColor.Red = 125;
pSimpleLineSymbol.Color = pRgbColor;
pRubberBand = new RubberLineClass();
pLineElement = new LineElementClass();
pLineElement.Symbol = pSimpleLineSymbol;
pPloyline = pRubberBand.TrackNew(pActiveView.ScreenDisplay, pSimpleLineSymbol as ISymbol) as IPolyline;
pElement = new LineElement();
pElement = pLineElement as IElement;
pElement.Geometry = pPloyline;
IGraphicsContainer pGraphicsContainer = axMapControl1.ActiveView.FocusMap as IGraphicsContainer;
pGraphicsContainer.AddElement(pElement, 0);
axMapControl1.ActiveView.Refresh();

}

原文地址:https://www.cnblogs.com/jinqier/p/2525040.html