实现效果:
窗体设置:
部分代码:
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using System;
using System.Windows.Forms;
using 景区导览系统;
namespace 重庆渝东南地理旅游信息系统.addfile
{
public partial class AddAFile : Form
{
private cForm mainForm;
public AddAFile(cForm cForm)
{
this.mainForm = cForm;
InitializeComponent();
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
mainForm.axMapControl1.Extent = mainForm.axMapControl1.FullExtent;
this.axTOCControl1.SetBuddyControl(this.mainForm.axMapControl1);
}
public void RefreshMap()
{
axMapControl1.ActiveView.Refresh();
}
String sEditLayerName;
private void miStartEditing_Click(object sender, EventArgs e)
{
SelectLayer selectLayer = new SelectLayer(this, mainForm.axMapControl1.Map);
if (selectLayer.ShowDialog() == DialogResult.OK)
{
sEditLayerName = selectLayer.getLayerName();
miStartEditing.Enabled = false;
miStopEditing.Enabled = true;
}
}
DrawPolygon drawPolygon = null;
private void miStopEditing_Click(object sender, EventArgs e)
{
miStopEditing.Enabled = false;
miStartEditing.Enabled = true;
if (drawPolygon != null)
{
drawPolygon.set_drawStart(false);//Stop creating polygons
drawPolygon = null;
}
}
private void AddAFile_Load(object sender, EventArgs e)
{
/// m_mapControl = (IMapControl3)mainForm.MainaxMapControl.Object;
IObjectCopy objectCopy = new ObjectCopy();
object copyFromMap = mainForm.axMapControl1.Map;
object copyMap = objectCopy.Copy(copyFromMap);
object copyToMap = axMapControl1.ActiveView.FocusMap;
objectCopy.Overwrite(copyMap, ref copyToMap);
}
private IMapControl3 m_mapControl = null;
private IPageLayoutControl3 m_pageLayoutControl = null;
private string m_mapDocumentName = string.Empty;
}
}
整个功能代码:
链接:https://pan.baidu.com/s/1jqWt-fjPaNNgEg2tZ2dpkQ
提取码:t7t2