arcengine 画多边形

本文介绍使用ArcGIS进行面要素绘制的方法。通过设置颜色、样式等属性,利用橡皮筋多边形工具实现地图上任意多边形的绘制,并将其添加到地图中。

 

 

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

}

 

转载于:https://www.cnblogs.com/jinqier/archive/2012/05/30/2525081.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值