esri帮助提供了使用比例尺的方法: Working with map surrounds

主要代码为:

public void AddMapSurround(IPageLayout pageLayout, IActiveView activeView)
{
IMap map = activeView.FocusMap;
IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;
IFrameElement frameElement = graphicsContainer.FindFrame(map);
IMapFrame mapFrame = (IMapFrame)frameElement;
IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();
UID elementUID = new UIDClass(); //The value determines the type of MapSurroundFrame being added.
elementUID.Value = "esriCarto.Legend"; //The CreateSurroundFrame method takes the UID of the element and an optional style.
mapSurroundFrame = mapFrame.CreateSurroundFrame(elementUID, null);
mapSurroundFrame.MapSurround.Name = "Legend"; //Cast the MapSurroundFrame as an element so it can be inserted into the page layout.
IElement doc_Element = mapSurroundFrame as IElement;
IElement mainMap_Element = mapFrame as IElement;
IGeometry geometry = mainMap_Element.Geometry;
IEnvelope mainMap_Envelope = geometry.Envelope;
IEnvelope envelope = new EnvelopeClass();
double xMin = mainMap_Envelope.XMax + 1.5;
double yMin = mainMap_Envelope.YMin + 1.5;
double xMax = mainMap_Envelope.XMax - 1.5;
double yMax = mainMap_Envelope.YMax - 1.5;
envelope.PutCoords(xMin, yMin, xMax, yMax); doc_Element.Geometry = envelope as IGeometry;
doc_Element.Activate(activeView.ScreenDisplay);
graphicsContainer.AddElement(doc_Element, 0); activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}

在实现地图同步后,分别获得IMap和IPageLayout对象,并调用之即可,如

//mapDoc.get_Map(0)
IMap map;
//map = map_Big.ActiveView as IMap;
IPageLayout pageLayout = pageLayoutCtrl.ActiveView as IPageLayout;
AddMapSurround(pageLayout, map_Big.ActiveView);

esri也提供使用指北针的方法,主要方法为:

public void AddNorthArrow(ESRI.ArcGIS.Carto.IPageLayout pageLayout, ESRI.ArcGIS.Carto.IMap map)
{ if(pageLayout == null || map == null)
{
return;
}
ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
envelope.PutCoords(0.2, 0.2, 5, 5); // Specify the location and size of the north arrow ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
uid.Value = "esriCarto.MarkerNorthArrow"; // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location
// Activate it and add it to the PageLayout's graphics container
ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = pageLayout as ESRI.ArcGIS.Carto.IGraphicsContainer; // Dynamic Cast
ESRI.ArcGIS.Carto.IActiveView activeView = pageLayout as ESRI.ArcGIS.Carto.IActiveView; // Dynamic Cast
ESRI.ArcGIS.Carto.IFrameElement frameElement = graphicsContainer.FindFrame(map);
ESRI.ArcGIS.Carto.IMapFrame mapFrame = frameElement as ESRI.ArcGIS.Carto.IMapFrame; // Dynamic Cast
ESRI.ArcGIS.Carto.IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null); // Dynamic Cast
ESRI.ArcGIS.Carto.IElement element = mapSurroundFrame as ESRI.ArcGIS.Carto.IElement; // Dynamic Cast
element.Geometry = envelope;
element.Activate(activeView.ScreenDisplay);
graphicsContainer.AddElement(element, 0);
ESRI.ArcGIS.Carto.IMapSurround mapSurround = mapSurroundFrame.MapSurround; // Change out the default north arrow
ESRI.ArcGIS.Carto.IMarkerNorthArrow markerNorthArrow = mapSurround as ESRI.ArcGIS.Carto.IMarkerNorthArrow; // Dynamic Cast
ESRI.ArcGIS.Display.IMarkerSymbol markerSymbol = markerNorthArrow.MarkerSymbol;
ESRI.ArcGIS.Display.ICharacterMarkerSymbol characterMarkerSymbol = markerSymbol as ESRI.ArcGIS.Display.ICharacterMarkerSymbol; // Dynamic Cast
characterMarkerSymbol.CharacterIndex = 200; // change the symbol for the North Arrow
markerNorthArrow.MarkerSymbol = characterMarkerSymbol;
}

ref: http://blog.csdn.net/freeWayWalker/article/details/25633859

esri: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//00490000004w000000

arcgis engine - 添加图例,指北针.的更多相关文章

  1. ArcGIS Engine添加地图元素的实现

    在ArcGIS中,我们使用的制图控件除了MapControl之外,还有PageLayoutControl,用于页面布局和制图,生成一幅成品地图. PageLayoutControl 封装了PageLa ...

  2. Arcgis Engine 添加一个Symbol符号样式步骤

    public static void DrawPictureMarkerSymbol(IGlobe globe, String layerName) { //添加一个图层 ESRI.ArcGIS.Ca ...

  3. ArcGIS Engine 添加SDE数据库

    public void AddSDELayer(bool ChkSdeLinkModle){  //定义一个属性   IPropertySet propset = new PropertySetCla ...

  4. [转] ArcGIS engine中气泡标注的添加、修改

    小生 原文 ArcGIS engine中气泡标注的添加.修改! 你微微地笑着,不同我说什么话.而我觉得,为了这个,我已等待得久了.                                   ...

  5. 《ArcGIS Engine+C#实例开发教程》第六讲 右键菜单添加与实现

    原文:<ArcGIS Engine+C#实例开发教程>第六讲 右键菜单添加与实现 摘要:在这一讲中,大家将实现TOCControl控件和主地图控件的右键菜单.在AE开发中,右键菜单有两种实 ...

  6. 《ArcGIS Engine+C#实例开发教程》第四讲 状态栏信息的添加与实现

    原文:<ArcGIS Engine+C#实例开发教程>第四讲 状态栏信息的添加与实现 摘要:在上一讲中,我们完成了 MapControl 和PageLayoutControl两种视图的同步 ...

  7. 《ArcGIS Engine+C#实例开发教程》第二讲 菜单的添加及其实现

    原文:<ArcGIS Engine+C#实例开发教程>第二讲 菜单的添加及其实现 摘要:在上一讲中,我们实现了应用程序基本框架,其中有个小错误,在此先跟大家说明下.在“属性”选项卡中,我们 ...

  8. ArcGIS Engine效率探究——要素的添加和删除、属性的读取和更新

    ArcGIS Engine效率探究——要素的添加和删除.属性的读取和更新 来自:http://blog.csdn.net/freewaywalker/article/details/23703863 ...

  9. ArcGIS Engine中添加点、线、面元素

    转自原文 ArcGIS Engine中添加点.线.面元素 此种方式为IElement的方式在axMapControl的GraphicsContainer中好绘制图形. //画点 IPoint pt = ...

随机推荐

  1. ES2015 (ES6)

    是时候使用ES 2015了 你可能不再需要Underscore BABEL Grunt 先 babel 再用 babel 后的文件 uglify 去掉严格模式.严格模式下全局的this转成了undef ...

  2. 常用SQL语句(增删查改、合并统计、模糊搜索)

    转自:http://www.cnblogs.com/ljianhui/archive/2012/08/13/2695906.html 常用SQL语句 首行当然是最基本的增删查改啦,其中最重要的是查. ...

  3. Oracle 12c最新特性

    9 Pluggable Databases This section provides details on the Pluggable Databases (PDB) metrics. 9.1 Da ...

  4. 如何避免jQuery库和其他库的冲突

    默认情形:jQuery用$作为自身的快捷方式 1. jQuery库在其他库之后导入 (1)方法:使用jQuery.noConflict()函数将变量$的控制权转移给其他库 (2)操作: (a)在js代 ...

  5. win7常用键

    (1)xp和win7中都可以使用Alt+Tab中进行标签切换,win7中添加了Wins+Tab可以进行3D标签切换. (2)你知道怎样一次过调整显示器亮度.音量大小,打开无线网,还能够看到本本电池电量 ...

  6. [洛谷U871]building

    题目来源:http://www.luogu.org/problem/show?pid=U871# [题目背景 Background] WOW是BLIZZARD公司开发的一款网络游戏,游戏的背景是处在一 ...

  7. win8下Oracle 12c 创建新用户并分配表空间

    这个应该算还是比较简单吧,找了个博客照着搞,有点不同的地方改改,自己再记录下. 步骤是这样: 1.先用SYSTEM登录SOL Plus, 2.创建一个临时表空间,再创建一个表空间,然后再创建一个用户 ...

  8. ThinkPHP 快速入门

    1. 框架简介 框架是程序结构代码的集合,而不是业务逻辑代码.集合中包含了很多类.函数和功能类包.这个集合是按照一定标准组成的功能体系.体系有很多设计模式,比如MVC等. 2. ThinkPHP框架学 ...

  9. Shell while循环

    while循环用于不断执行一系列命令,也用于从输入文件中读取数据:命令通常为测试条件.其格式为: while command do Statement(s) to be executed if com ...

  10. 【Java重构系列】重构31式之搬移方法

    重构第二式:搬移方法 (Refactoring 2: Move Method) 毋容置疑,搬移方法(Move Method)应该是最常用的重构手段之一,正因为太常用而且较为简单,以至于很多人并不认为它 ...