在《ArcGIS Engine+C#实例开发教程》第三讲 MapControl与PageLayoutControl同步中
运行后出现:ControlsSynchronizer::BindControls:EitherMapControlorPageLayoutControlarenotini...
运行后出现:
ControlsSynchronizer::BindControls: Either MapControl or PageLayoutControl are not initialized!
求助大神啊!!! 展开
ControlsSynchronizer::BindControls: Either MapControl or PageLayoutControl are not initialized!
求助大神啊!!! 展开
4个回答
展开全部
form load下语句顺序错误,改一下
m_mapControl = (IMapControl3)this.axMapControl1.Object;
m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
//初始化controls synchronization calss
m_controlsSynchronizer = new
ControlsSynchronizer(m_mapControl, m_pageLayoutControl);
//把MapControl和PageLayoutControl绑定起来(两个都指向同一个Map),然后设置MapControl为活动的Control
m_controlsSynchronizer.BindControls(true);
//为了在切换MapControl和PageLayoutControl视图同步,要添加Framework Control
m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl1.Object);
// 添加打开命令按钮到工具条
OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);
axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);
m_mapControl = (IMapControl3)this.axMapControl1.Object;
m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
//初始化controls synchronization calss
m_controlsSynchronizer = new
ControlsSynchronizer(m_mapControl, m_pageLayoutControl);
//把MapControl和PageLayoutControl绑定起来(两个都指向同一个Map),然后设置MapControl为活动的Control
m_controlsSynchronizer.BindControls(true);
//为了在切换MapControl和PageLayoutControl视图同步,要添加Framework Control
m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl1.Object);
// 添加打开命令按钮到工具条
OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);
axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
展开全部
错误提示是:MapControl or PageLayoutControl为初始化
解决:在form_Load添加如下语句,看是否成功
m_mapControl = (IMapControl3)this.axMapControl1.Object;
m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
解决:在form_Load添加如下语句,看是否成功
m_mapControl = (IMapControl3)this.axMapControl1.Object;
m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
您好,
private void SetBuddies(object buddy)
{
try
{
if (buddy == null)
throw new Exception("ControlsSynchronizer::SetBuddies:\r\nTarget Buddy Control is not initialized!");
foreach (object obj in m_frameworkControls)
{
if (obj is IToolbarControl)
{
((IToolbarControl)obj).SetBuddyControl(buddy);
}
else if (obj is ITOCControl)
{
((ITOCControl)obj).SetBuddyControl(buddy);
}
}
}
catch (Exception ex)
{
throw new Exception(string.Format("ControlsSynchronizer::SetBuddies:\r\n{0}", ex.Message));
}
}
private void SetBuddies(object buddy)
{
try
{
if (buddy == null)
throw new Exception("ControlsSynchronizer::SetBuddies:\r\nTarget Buddy Control is not initialized!");
foreach (object obj in m_frameworkControls)
{
if (obj is IToolbarControl)
{
((IToolbarControl)obj).SetBuddyControl(buddy);
}
else if (obj is ITOCControl)
{
((ITOCControl)obj).SetBuddyControl(buddy);
}
}
}
catch (Exception ex)
{
throw new Exception(string.Format("ControlsSynchronizer::SetBuddies:\r\n{0}", ex.Message));
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-04-09
展开全部
楼主解决了么,我也碰到了同样的问题...
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询