Chinaunix首页 | 论坛 | 博客
  • 博客访问: 256001
  • 博文数量: 45
  • 博客积分: 170
  • 博客等级: 入伍新兵
  • 技术积分: 488
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-13 14:43
文章分类

全部博文(45)

文章存档

2014年(2)

2013年(35)

2012年(8)

我的朋友

分类: C#/.net

2013-05-26 19:33:31


点击(此处)折叠或打开

  1. IMap pMap;
  2. IActiveView pActiveView;
  3. pMap = axMapControl1.Map;
  4. pActiveView = pMap as IActiveView;
  5. double gap = 0.5;
  6. IPointCollection pPCol = new Polygon();
  7. IPoint pPoint = null;
  8. object ptmp = Type.Missing;
  9. pPoint = new ESRI.ArcGIS.Geometry.Point();
  10. pPoint.X = e.mapX - gap;
  11. pPoint.Y = e.mapY + gap;
  12. pPCol.AddPoint(pPoint, ref ptmp, ref ptmp);

  13. pPoint.X = e.mapX - gap;
  14. pPoint.Y = e.mapY - gap;
  15. pPCol.AddPoint(pPoint, ref ptmp, ref ptmp);

  16. pPoint.X = e.mapX + gap;
  17. pPoint.Y = e.mapY - gap;
  18. pPCol.AddPoint(pPoint, ref ptmp, ref ptmp);

  19. pPoint.X = e.mapX + gap;
  20. pPoint.Y = e.mapY + gap;
  21. pPCol.AddPoint(pPoint, ref ptmp, ref ptmp);
  22. ISimpleFillSymbol pSimpleFillSym;//用来实现填充
  23. pSimpleFillSym = new SimpleFillSymbol();
  24.                 
  25. IColor pColor = new RgbColor();
  26. pColor.RGB = 255;
  27. pSimpleFillSym.Color = pColor;
  28. IFillShapeElement pPolygonEle;
  29. pPolygonEle = new PolygonElement() as IFillShapeElement;
  30. pPolygonEle.Symbol = pSimpleFillSym;
  31. IElement pEle;
  32. pEle = pPolygonEle as IElement;             
  33. pEle.Geometry = pPCol as IGeometry;

  34. //将元素添加到Map对象中
  35. IGraphicsContainer pGrapgicsContainer;
  36. pGrapgicsContainer = pMap as IGraphicsContainer;
  37. pGrapgicsContainer.AddElement(pEle, 0);
  38. pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

阅读(3225) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~