Here's a C# example thats adds the circle as a graphic element on the mapcontrol.

//C#

private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)

{

if (e.button == 2)

{

IRubberBand rubberband = new RubberCircleClass();

IGeometry geometry = rubberband.TrackNew(this.axMapControl1.ActiveView.ScreenDisplay, null);

CreateCircleElement(geometry, this.axMapControl1.Map);

this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

}

}

private void CreateCircleElement(IGeometry geometry, IMap map)

{

ISegment segment = geometry as ISegment;

ISegmentCollection polygon = new PolygonClass();

object Missing = Type.Missing;

polygon.AddSegment(segment, ref Missing, ref Missing);

IElement element = new CircleElement();

element.Geometry = polygon as IGeometry;

IGraphicsContainer graphicsContainer = map as IGraphicsContainer;

graphicsContainer.AddElement(element, 0);

}
 

你可能感兴趣的:(element)