增加图例 Legend和删除图例
private void button1_Click(object sender, System.EventArgs e)
{
//Get the GraphicsContainer
IGraphicsContainer graphicsContainer = axPageLayoutControl1.GraphicsContainer;
//Get the MapFrame
IMapFrame mapFrame = (IMapFrame) graphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap);
if (mapFrame == null) return;
//Create a legend
UID uID = new UIDClass();
uID.Value = "esriCarto.Legend";
//Create a MapSurroundFrame from the MapFrame
IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uID, null);
if (mapSurroundFrame == null) return;
if (mapSurroundFrame.MapSurround == null) return;
//Set the name
mapSurroundFrame.MapSurround.Name = "Legend";
//Envelope for the legend
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(1, 1, 3.4, 2.4);
//Set the geometry of the MapSurroundFrame
IElement element = (IElement) mapSurroundFrame;
element.Geometry = envelope;
//Add the legend to the PageLayout
axPageLayoutControl1.AddElement(element, Type.Missing, Type.Missing, "Legend", 0);
//Refresh the PageLayoutControl
axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
//disable/enable buttons
cmdDraw.Enabled = false;
cmdDelete.Enabled = true;
cmdChangeArea.Enabled = true;
cmdChangeLine.Enabled = true;
}
private void button2_Click(object sender, System.EventArgs e)
{
//Find the legend
IElement element = axPageLayoutControl1.FindElementByName("Legend", 1);
if(element != null)
{
//Delete the legend
IGraphicsContainer graphicsContainer = axPageLayoutControl1.GraphicsContainer;
graphicsContainer.DeleteElement(element);
//Refresh the display
axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
//enable/disable buttons
cmdDraw.Enabled = true;
cmdDelete.Enabled = false;
cmdChangeArea.Enabled = false;
cmdChangeLine.Enabled = false;
}
}
增加图例 Legend和删除图例的更多相关文章
- highcharts图表的图例legend怎么改变显示位置
一.将图例Legend放于图表右侧1.设置chart的marginRight属性值:chart: { marginRight: 120}2.设置legend图例属性值如下 legend: { alig ...
- highcharts图表的图例legend
一.将图例Legend放于图表右侧1.设置chart的marginRight属性值:chart: { marginRight: 120}2.设置legend图例属性值如下 legend: { alig ...
- python 2: 解决python中的plot函数的图例legend不能显示中文问题
问题: 图像标题.横纵坐标轴的标签都能显示中文名字,但是图例就是不能显示中文,怎么解决呢? 解决: plt.figure() plt.title(u'训练性能', fontproperties=f ...
- echart 饼图图例legend支持滑动
ps: 以下针对option操作 文章目录 图例过多加上滚动条图例形状图例自定义显示图例过多加上滚动条 legend:{ top:'50', bottom:'50', type:'scroll',} ...
- fusioncharts图例(legend)属性
图例用来在多系列图和混合图中将图形和对应的系列名称联系起来. 从v3.2开始,每个系列的名称前面会展示对应的icon图标,这些图标具有交互作用,用户可以通过点击这些图标来显示或者隐藏对应的数 ...
- ASP.NET MVC3 实例(六) 增加、修改和删除操作(二)
http://www.jquery001.com/asp.net-mvc3-instance-add-update-delete2.html 上篇我们在 ASP.NET MVC3 中实现了添加操作,由 ...
- ASP.NET 操作Cookie详解 增加,修改,删除
ASP.NET 操作Cookie详解 增加,修改,删除 Cookie,有时也用其复数形式Cookies,指某些网站为了辨别用户身份而储存在用户本地终端上的数据(通常经过加密).定义于RFC2109.它 ...
- MBR分区操作-增加、扩展、删除
MBR分区操作-增加.扩展.删除 GPT分区参考 http://www.blogjava.net/haha1903/archive/2011/12/21/366942.html l fdisk 显示 ...
- 在linux中,如何增加、修改、删除、暂停和冻结用户名
在Linux中,如何增加.修改.删除.暂停和冻结用户名 在操作增加.修改和删除用户名前,先认识linux中两个最重要的文件,它们就是账号管理最重要文件“/etc/passwd”与“etc/shadow ...
随机推荐
- LeetCode All in One题解汇总(持续更新中...)
突然很想刷刷题,LeetCode是一个不错的选择,忽略了输入输出,更好的突出了算法,省去了不少时间. dalao们发现了任何错误,或是代码无法通过,或是有更好的解法,或是有任何疑问和建议的话,可以在对 ...
- EJB3 阶段总结+一个EJB3案例 (1)
经过一段时时间的学习,对EJB3的相关知识和jboss8的配置有了大概的了解. 网上对EJB的评论很多,基本都是负面的,都表示EJB太过于沉重,不容易维护.但通过这段时间的学习,私下认为,EJB3在某 ...
- Java之集合(二十六)ConcurrentSkipListMap
转载请注明源出处:http://www.cnblogs.com/lighten/p/7542578.html 1.前言 一个可伸缩的并发实现,这个map实现了排序功能,默认使用的是对象自身的compa ...
- jenkins自动部署tomcat
关于部署的3种思路: 远程部署(jenkins编译部署到远程服务器): 安装ssh插件 ssh插件配置 添加远程jenkins服务器节点: 本地部署(与jenkins在同一服务器): 关于maven构 ...
- Eclipse及IDEA插件开发
https://github.com/eclipse/eclipse.jdt.ui http://www.eclipse.org/jdt/ui/ https://www.cnblogs.com/xin ...
- Python&Appium实现安卓手机图形解锁
首先,在解锁状态下,建立一个Session,打开APP.然后,调用press_keycode()方法传入整型数值"26",锁定屏幕.通过implicitly_wait()方法等待两 ...
- 10-hdfs-hdfs搭建
hdfs的优缺点比较: 架构图解分析: nameNode的主要任务: SNameNode的功能: (不是NN的备份, 主要用来合并fsimage) 合并流程: dataNode的主要功能: HDFS上 ...
- ES6那些事半功倍的新特性(一)
数组方面 Array.from(xxx):把json格式字符串转换成数组: Array.of(x,x,x):负责把一堆文本或者变量转换成数组 find( ):该方法为实例方法,就是以Array对象开头 ...
- ARM的体系结构与编程系列博客——ARM的历史与应用范围
前言 最近我感觉自己比较浮躁,重来没有好好地沉下心来做一件事情,而且针对自己在专业水平上仍然还有很多欠缺,于是我想我应该为自己做些什么来证明一下自己真的是潜心研究东西的人,于是我萌生了一个想法,真正地 ...
- [转]Enabling CRUD Operations in ASP.NET Web API 1
本文转自:https://docs.microsoft.com/en-us/aspnet/web-api/overview/older-versions/creating-a-web-api-that ...