MapControl无法显示地图
问题来源:
添加axmapcontrol控件显示地图,通过loadmxdfile接口加载地图,刷新地图
问题表现:
地图内容无法显示,通过axmapcontrol.map可以获取到当前地图的图层
其他:
1、如果在axmapcontrol的控件中设置了map document的路径,加载的地图可以显示
2、可以排除路径问题,license绑定我参考samples里的mapviewerworkthrough
源代码:
private void Form1_Load(object sender, EventArgs e)
{
string MxdPath = @"C:\Users\Administrator\Desktop\DiseaseGIS\DXApplication1\bin\Debug\baseInfo\Map\01.mxd";
axMapControl1.LoadMxFile(MxdPath);
string mapName = axMapControl1.Map.Name;
System.Windows.Forms.MessageBox.Show("my map name is " + mapName);
System.Windows.Forms.MessageBox.Show("总共" + axMapControl1.Map.LayerCount.ToString()+"个图层");
axMapControl1.Extent = axMapControl1.Map.get_Layer(0).AreaOfInterest;// axMapControl1.FullExtent;
axMapControl1.Refresh();
}
添加axmapcontrol控件显示地图,通过loadmxdfile接口加载地图,刷新地图
问题表现:
地图内容无法显示,通过axmapcontrol.map可以获取到当前地图的图层
其他:
1、如果在axmapcontrol的控件中设置了map document的路径,加载的地图可以显示
2、可以排除路径问题,license绑定我参考samples里的mapviewerworkthrough
源代码:
private void Form1_Load(object sender, EventArgs e)
{
string MxdPath = @"C:\Users\Administrator\Desktop\DiseaseGIS\DXApplication1\bin\Debug\baseInfo\Map\01.mxd";
axMapControl1.LoadMxFile(MxdPath);
string mapName = axMapControl1.Map.Name;
System.Windows.Forms.MessageBox.Show("my map name is " + mapName);
System.Windows.Forms.MessageBox.Show("总共" + axMapControl1.Map.LayerCount.ToString()+"个图层");
axMapControl1.Extent = axMapControl1.Map.get_Layer(0).AreaOfInterest;// axMapControl1.FullExtent;
axMapControl1.Refresh();
}
2 个回复
朱新颖
赞同来自:
石羽
赞同来自:
可以用ArcMap打开这个mxd看看,如果Toc有红叹号则可证明。
要回复问题请先登录或注册
发起人
相关问题
问题状态