代码中有注释,直接上

指北针

public void AddNorthArrow(IPageLayout pageLayout)

{

IGraphicsContainer container = pageLayout as IGraphicsContainer;

IActiveView activeView = pageLayout as IActiveView;

// 获得MapFrame

IFrameElement frameElement = container.FindFrame(activeView.FocusMap);

IMapFrame mapFrame = frameElement as IMapFrame;

//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround

UID uid = new UIDClass();

uid.Value = "esriCarto.MarkerNorthArrow";

IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);

//设置MapSurroundFrame中指北针的点符号

IMapSurround mapSurround = mapSurroundFrame.MapSurround;

IMarkerNorthArrow markerNorthArrow = mapSurround as IMarkerNorthArrow;

IMarkerSymbol markerSymbol = markerNorthArrow.MarkerSymbol;

markerSymbol.Size = 18;

markerNorthArrow.MarkerSymbol = markerSymbol;

//QI,确定mapSurroundFrame的位置

IElement element = mapSurroundFrame as IElement;

IEnvelope envelope = new EnvelopeClass();

envelope.PutCoords(0.2, 0.2, 5, 5);

element.Geometry = envelope;

//使用IGraphicsContainer接口添加显示

container.AddElement(element, 0);

activeView.Refresh();

}

比例尺

public void AddScalebar(IPageLayout pageLayout)

{

IGraphicsContainer container = pageLayout as IGraphicsContainer;

IActiveView activeView = pageLayout as IActiveView;

// 获得MapFrame

IFrameElement frameElement = container.FindFrame(activeView.FocusMap);

IMapFrame mapFrame = frameElement as IMapFrame;

//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround

UID uid = new UIDClass();

uid.Value = "esriCarto.AlternatingScaleBar";

IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);

//设置MapSurroundFrame中比例尺的样式

IMapSurround mapSurround = mapSurroundFrame.MapSurround;

IScaleBar markerScaleBar = ((IScaleBar)mapSurround);

markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;

markerScaleBar.UseMapSettings();

//QI,确定mapSurroundFrame的位置

IElement element = mapSurroundFrame as IElement;

IEnvelope envelope = new EnvelopeClass();

envelope.PutCoords(0.2, 0.2, 1, 2);

element.Geometry = envelope;

//使用IGraphicsContainer接口添加显示

container.AddElement(element, 0);

activeView.Refresh();

}

图例

private void AddLegend(IPageLayout pageLayout)

{

IActiveView pActiveView = pageLayout as IActiveView;

IGraphicsContainer container = pageLayout as IGraphicsContainer;

// 获得MapFrame

IMapFrame mapFrame = container.FindFrame(pActiveView.FocusMap) as IMapFrame;

//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround

UID uid = new UIDClass();

uid.Value = "esriCarto.Legend";

IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);

//设置图例的Title

ILegend2 legend = mapSurroundFrame.MapSurround as ILegend2;

legend.Title = "地图图例";

ILegendFormat format = new LegendFormatClass();

ITextSymbol symbol = new TextSymbolClass();

symbol.Size = 4;

format.TitleSymbol = symbol;

legend.Format = format;

//QI,确定mapSurroundFrame的位置

IElement element = mapSurroundFrame as IElement;

IEnvelope envelope = new EnvelopeClass();

envelope.PutCoords(2, 2, 8, 8);

element.Geometry = envelope;

//使用IGraphicsContainer接口添加显示

container.AddElement(element, 0);

pActiveView.Refresh();

}

分享到:

2011-12-15 10:50

浏览 11672

评论

南方cass怎么添加指北针_添加图例、比例尺、指北针相关推荐

  1. unity_NGUI系统学习(十)_PlaySound添加声音_添加打字机效果TypewriterEffect

    unity_NGUI系统学习(十)_PlaySound添加声音_添加打字机效果TypewriterEffect<7/10/2017> 1.因为要实现声音的交互,首先你得给目标对象添加一个B ...

  2. 南方cass怎么添加指北针_添加比例尺 指北针

    添加图例.比例尺.指北针 代码中有注释,直接上 指北针 C# 代码  public void AddNorthArrow(IPageLayout pageLayout)  {  IGraphic ...

  3. java添加窗体_添加的窗体

    [java]代码库import java.awt.Button; import java.awt.Label; import java.awt.List; import java.awt.TextFi ...

  4. 南方cass字体样式设置_统一设置导航条风格和修改字体

    在Swift中,如果想设置导航条的背景色及字体可以这样做 在didFinishLaunching方法中写入 UINavigationBar.appearance().barTintColor //统一 ...

  5. 南方cass字体样式设置_为什么装了CASS所有字体,还是有文字显示问号?

    最近常常被生态圈的圈友私信:为什么已经安装了CASS的所有字体,为什么还是会出现文字变成问号的情况?还有下图所示的,部分文字显示问号,就更让人纳闷了!字体显示异常的文字截图 这种显示问号的,一般都是字 ...

  6. CaSS中lisp命令不可用_小白想要自学南方cass?又苦于不会修改比例尺,这里有一份小白快速上手的测绘神器...

    小白想要自学南方cass?又苦于不会修改比例尺,这里有一份小白快速上手的测绘神器 自CASS软件推出以来,市场占有率遥遥领先,已经成为业内应用最广.使用最方便快捷的软件品牌.也是用户量最大.升级最快. ...

  7. cass读取dat文件_南方CASS教程+视频讲解+插件汇总,小白快速上手的测绘神器

    南方CASS教程+视频讲解+插件汇总,小白快速上手的测绘神器 自CASS软件推出以来,市场占有率遥遥领先,已经成为业内应用最广.使用最方便快捷的软件品牌.也是用户量最大.升级最快.服务最好的主流成图和 ...

  8. 添加流程_艾多美手机商城苹果ios系统的主屏幕添加流程

    嗨,大家好,我是你们的老朋友莎莎老师,最近有很多朋友都在问莎莎老师,苹果手机的APP商城什么时候可以下载安装,因为目前苹果版的艾多美手机商城只有网页版,还没有出苹果ios系统版本的APP软件程序,所以 ...

  9. R语言ggplot2可视化自定义图例实战:添加自定义的图例、添加填充色的图例

    R语言ggplot2可视化自定义图例实战:添加自定义的图例.添加填充色的图例 目录

最新文章

  1. 隐私数据在隐私AI框架中的安全流动
  2. mysql mysql常用的常用函数
  3. MFC 最详细入门教程
  4. 洛谷P1978 集合 [2017年6月计划 数论08]
  5. 桌面有u盘符计算机里没有了,教你电脑不显示u盘盘符怎么办
  6. Unity 基础 之 IDragHanlder 简单实现 UGUI 元素随着鼠标移动,拖动的效果
  7. xprinter打印机android 开发文档,芯烨智能打印机,让手机功能更神奇
  8. 智能人物画像综合分析系统 6.29
  9. 原生JS实现简单打砖块弹球小游戏
  10. getcwd()函数的用法
  11. Uva 167 The Sultan's Successors(dfs)
  12. SAP MM 根据采购订单反查采购申请?
  13. 360极速浏览器以及360安全浏览器在兼容模式下验证码图片显示不来,但是极速模式可以显示?
  14. 国内有什么好的前端学习网站推荐?
  15. Python批量处理jpg转换为bmp图片,告别手动转换,真爽,
  16. hbuilder版本更新失败_HBuilderX版本升级问题引发的血案(持续更新中)
  17. Red Hat Enterprise Linux 7 正式版发布
  18. 汉寿计算机职业中专,汉寿第一职业中专
  19. 机器学习案例之Python中通过RF预测红酒质量
  20. 路缘石成型机对着项目质量加强的方向努力

热门文章

  1. Latex固定表格图片位置
  2. 积分球式光源色温校准
  3. 时间序列数据的白噪声检验
  4. excel计算机一级打不开,【2人回答】Excel表格太大,电脑打不开如何解决?-3D溜溜网...
  5. python3实现maxent 最大熵模型
  6. js飞机大战碰撞检测
  7. 网络安全应急响应----10、内存分析
  8. 看《赘婿》我不仅收获了快乐,还收获了独特的目标管理方法(OKRs-E)
  9. kvm静态迁移error: Cannot access storage file
  10. nginx配置禁止访问目录或禁止访问目录下的文件