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

IRgbColor pRgbColor;
IActiveView pActiveView;
IRubberBand pRubberBand;
IElement pElement;
IGraphicsContainer pGraphicsContainer;//起到容器的作用,可使画的内容不消失

IPolygonElement pPolygonElement;
ISimpleFillSymbol pSimpleFillSymbol;
IPolygon pPolygon;

pActiveView = axMapControl1.ActiveView;
pSimpleFillSymbol = new SimpleFillSymbolClass();
pSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSBackwardDiagonal;//面的样式
pRgbColor = new RgbColorClass();
pRgbColor.Red = 250;
pSimpleFillSymbol.Color = pRgbColor;
pRubberBand = new RubberPolygonClass();
pPolygonElement = new PolygonElementClass();
pPolygon = pRubberBand.TrackNew(pActiveView.ScreenDisplay, pSimpleFillSymbol as ISymbol) as IPolygon;
pElement = new PolygonElement();
pElement = pPolygonElement as IElement;
pElement.Geometry = pPolygon;
pGraphicsContainer = axMapControl1.ActiveView.FocusMap as IGraphicsContainer;
pGraphicsContainer.AddElement(pElement, 0);
axMapControl1.ActiveView.Refresh();

}

 

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-01-26
  • 2022-12-23
  • 2022-01-26
猜你喜欢
  • 2021-09-13
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-05-12
相关资源
相似解决方案