1,第一种方法 MapControl 直接添加
if (!axMapControl1.CheckMxFile(FileName))
{
MessageBox.Show("文件不合法");
return;
}
else
{
axMapControl1.LoadMxFile(FileName);
}
第二种方法:通过MapDocument 进行添加
string FileName = open.FileName;
IMapDocument mapDoc = new MapDocument();
mapDoc.Open(FileName, "");
axMapControl1.Map = mapDoc.ActiveView.FocusMap;
axMapControl1.ActiveView.Refresh();