ArcEngine同步数据视图与布局视图


// 数据视图与布局视图同步
private void mainMapControl_OnAfterScreenDraw(object sender, IMapControlEvents2_OnAfterScreenDrawEvent e)
{
    IActiveView pActiveView = (IActiveView)mainPageLayoutControl1.ActiveView.FocusMap;
    IDisplayTransformation displayTransformation = pActiveView.ScreenDisplay.DisplayTransformation;
    displayTransformation.VisibleBounds = mainMapControl.Extent;
    mainPageLayoutControl1.ActiveView.Refresh();
    CopyToPageLayout();  // 调用下面的函数

}

// CopyToPageLayout() 布局视图与数据视图同步
private void CopyToPageLayout()
{
    IObjectCopy pObjectCopy = new ObjectCopyClass();
    object copyFromMap = mainMapControl.Map;
    object copiedMap = pObjectCopy.Copy(copyFromMap);   // 复制地图到copiedMap中
    object copyToMap = mainPageLayoutControl1.ActiveView.FocusMap;
    pObjectCopy.Overwrite(copiedMap, ref copyToMap);   // 复制地图
    mainPageLayoutControl1.ActiveView.Refresh();

}

文章作者: 剑胆琴心
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 剑胆琴心 !
评论
  目录