修改比例尺
作者:互联网
//修改比例尺
[DllImport("User32.dll")]
public static extern int GetDesktopWindow();
public static void ChangeMapScale(double scale)
{
//mapDocument.Open(@"C:\Temp\foo.mxd", null);
//IPageLayout pageLayout = mapDocument.PageLayout;
IPageLayout pageLayout = ArcMap.Document.PageLayout;
IActiveView activeView = (IActiveView)pageLayout;
IMap map = activeView.FocusMap;
activeView = (IActiveView)ArcMap.Document.PageLayout;
activeView.Activate(GetDesktopWindow()); // 注意,调用了这个函数,才使得设置 MapScale 生效
map.MapScale = scale;
activeView.Refresh();
(ArcMap.Document as IMapDocument).Save(true, true);
}
标签:pageLayout,IActiveView,PageLayout,修改,ArcMap,Document,比例尺,activeView 来源: https://www.cnblogs.com/wzyong/p/16066449.html