概述
转自 http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=84368 -Esri中国社区
代码清晰很值得参考
IActiveView pActiveView;
IMap pMap;IGraphicsContainer pGraphicscon;
INewCircleFeedback pCircleFeed;
private void Form1_Load(object sender, EventArgs e)
{
pMap = axMapControl1.Map;
pActiveView = pMap as IActiveView;
pGraphicscon = pActiveView as IGraphicsContainer;
}
private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
IPoint StartPoint = new PointClass();
StartPoint.PutCoords(e.mapX, e.mapY);
if (pCircleFeed == null)
{
pCircleFeed = new NewCircleFeedbackClass();
pCircleFeed.Display = pActiveView.ScreenDisplay;
pCircleFeed.Start(StartPoint);
}
}
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
{
IPoint MovePoint = new PointClass();
MovePoint.PutCoords(e.mapX, e.mapY);
if (pCircleFeed != null)
pCircleFeed.MoveTo(MovePoint);
}
private void axMapControl1_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
{
IGeometry pGeo = pCircleFeed.Stop();
pCircleFeed = null;
IFillShapeElement pFillShap=new CircleElementClass ();
IElement pEle = pFillShap as IElement;
pEle.Geometry = pGeo;
//pActiveView.Refresh();
pGraphicscon.AddElement(pEle, 0);
pActiveView.Refresh();
}
最后
以上就是爱笑小伙为你收集整理的IGraphicsContainer添加圆形元素的全部内容,希望文章能够帮你解决IGraphicsContainer添加圆形元素所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复