C#写AO,如何在ArcMap的地图上画线,求教

2025-06-21 02:13:16
推荐回答(1个)
回答1:

 IGeometry pGeo;
 pGeo = mMapControl.TrackLine();//画线工具
 ILineElement pLineElement;
 pLineElement = new LineElementClass();
 IElement pElement;
 pElement = pLineElement as IElement;
 pElement.Geometry = pGeo;
 //设置线符号的颜色和线宽
 ISimpleLineSymbol pSymbol = new SimpleLineSymbolClass();
 pSymbol.Color = MapManager.GetRgbColor(0, 0, 255);
 pSymbol.Width = 1.5;
 pLineElement.Symbol = pSymbol;
            
 //在图形容器中添加并显示所画的线
  pGraphicsContainer = m_Map as IGraphicsContainer;
  pGraphicsContainer.AddElement((IElement)pLineElement, 0);
  m_activeView.Refresh();