//修改比例尺
[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);
}
修改地图比例尺
最新推荐文章于 2024-11-07 08:51:26 发布