关于argis的问题, 如何在winform中的地图上绘制一个圆形的阴影区域呢? 类似于百度地图api的Circle区域        private void Test()
        {
            IGraphicsContainer pGraphicsContainer;
            IMap pMap = axMapControl1.Map;
            IActiveView pActiveView = axMapControl1.ActiveView;            IGeometry Polygon;
            Polygon = axMapControl1.TrackPolygon();
            IPolygonElement PolygonElement;
            PolygonElement = new PolygonElementClass();            IElement pElement;
            pElement = PolygonElement as IElement;
            pElement.Geometry = Polygon;// 这里报错: 未将对象引用到对象的实例, Polygon为null
            pGraphicsContainer = pMap as IGraphicsContainer;
            pGraphicsContainer.AddElement((IElement)PolygonElement, 0);
            pActiveView.Refresh();
        }试着修改了一下, 成了下面的样子, 没有报错,但也没有绘制(这是当然的,因为就没有设置绘制的相关属性)        private void Test()
        {
            IGraphicsContainer pGraphicsContainer;
            IMap pMap = axMapControl1.Map;
            IActiveView pActiveView = axMapControl1.ActiveView;            IGeometry Polygon;
            Polygon = new PolygonClass();
            IPolygonElement PolygonElement;
            PolygonElement = new PolygonElementClass();            IElement pElement;
            pElement = PolygonElement as IElement;
            pElement.Geometry = Polygon;// 这里报错: 未将对象引用到对象的实例, Polygon为null
            pGraphicsContainer = pMap as IGraphicsContainer;
            pGraphicsContainer.AddElement((IElement)PolygonElement, 0);
            pActiveView.Refresh();
        }然后试着设置Polygon的属性, Demension, Envelope, GeometryType, IsEmpty都是只读属性, 只有一个SpaticalReference是读写属性Spatical意思是空间, Reference意思应该是引用. 引用空间? 不懂.试着折腾了一番, 成了下面一堆        private void Test()
        {
            IGraphicsContainer pGraphicsContainer;
            IMap pMap = axMapControl1.Map;
            IActiveView pActiveView = axMapControl1.ActiveView;            IGeometry Polygon;
            Polygon = new PolygonClass();
            Polygon.SpatialReference = axMapControl1.Map as ISpatialReference;
            IPolygonElement PolygonElement;
            PolygonElement = new PolygonElementClass();            IElement pElement;
            pElement = PolygonElement as IElement;
            pElement.Geometry = Polygon;// 这里报错: 未将对象引用到对象的实例, Polygon为null
            pGraphicsContainer = pMap as IGraphicsContainer;
            pGraphicsContainer.AddElement((IElement)PolygonElement, 0);
            pActiveView.Refresh();
        }没有办法, 求救!! 需要在空白的axMapControl空间上绘制一个圆形阴影区域, 可以定义圆心和半径, 如果可以的话同时能够定义透明度

解决方案 »

  1.   

    随便给你搜一篇文章https://www.cnblogs.com/tsliwei/p/5616381.html当你设计一个大系统时,如果你的工具决定了你用5年时间都还在纠结最底层的“点线面”的时候,做不了别人用半个月开发出来的东西的时候,那么你就应该选择一个专门用来开发2d-3d图形系统的开发平台来学习,从使用高级的一整套绘图控件开始学习。
      

  2.   

    对于 argis 的问题要看它自己的教程。前提是有图形应用开发基础。比如说你不知道pElement这里根本没有为变量引用任何对象,这样搞开发继续下去其实就是比较痛苦了。
      

  3.   

    可以使用GDI绘图