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();

}

posted on 2012-05-30 08:19  jin_qi_er  阅读(550)  评论(0编辑  收藏  举报