天天看點

【ArcGIS Engine二次開發(基于c#)】在MapControl繪制多邊形

在MapControl繪制多邊形

  • MapControl的OnMouseDown事件

主要代碼:

private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
  IGeometry pGe = axMapControl1.TrackPolygon();
  IElement pElement = new PolygonElementClass() as IElement;
  pElement.Geometry = pGe;
  IGraphicsContainer GraphicsContainer = axMapControl1.Map as IGraphicsContainer;
  GraphicsContainer.AddElement(pElement, 0);
  axMapControl1.ActiveView.Refresh();
}
           

繼續閱讀