ArcGIS Engine中添加點、線、面元素

//畫點
IPoint pt = axMapControl1.ToMapPoint(e.x, e.y);
IMarkerElement pMarkerElement = new MarkerElementClass();
IElement pElement = pMarkerElement as IElement;
pElement.Geometry = pt;
IGraphicsContainer pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pMarkerElement, 0);
pActiveView.Refresh();

//畫線
IGeometry polyline = axMapControl1.TrackLine();
ILineElement pLineElement = new LineElementClass();
IElement pElement = pLineElement as IElement;
pElement.Geometry = polyline;
IGraphicsContainer pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pLineElement, 0);
pActiveView.Refresh();

//畫面
IGeometry Polygon = axMapControl1.TrackPolygon();
IPolygonElement PolygonElement = new PolygonElementClass();
IElement pElement = PolygonElement as IElement;
pElement.Geometry = Polygon;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)PolygonElement, 0);
pActiveView.Refresh();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章