增加图例 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;
}
}

时间: 2024-08-06 11:45:51

增加图例 Legend和删除图例的相关文章

Matlab Plot 使用多个图例( legend )

用matlab 画图时,发现线太多,生成的图例,遮盖了曲线.于是想画成多个图例,然后可以自由拖动. 废话不多说,1)代码: 2)效果. %%%%%%%%%%%% Code: figure %% ---- plot for maxtries performance set(0,'DefaultTextFontName','Times',... 'DefaultTextFontSize',16,... 'DefaultAxesFontName','Times',... 'DefaultAxesFon

python 2: 解决python中的plot函数的图例legend不能显示中文问题

 问题: 图像标题.横纵坐标轴的标签都能显示中文名字,但是图例就是不能显示中文,怎么解决呢?  解决: 1 plt.figure() 2 plt.title(u'训练性能', fontproperties=font) 3 plt.plot(history.epoch, history.history['loss'], label=u'训练误差') 4 plt.plot(history.epoch, history.history['val_loss'], label=u'验证误差') 5 plt

ggplot2-设置图例(legend)

本文更新地址:http://blog.csdn.net/tanzuozhev/article/details/51108040 本文在 http://www.cookbook-r.com/Graphs/Scatterplots_(ggplot2)/ 的基础上加入了自己的理解 图例用来解释图中的各种含义,比如颜色,形状,大小等等, 在ggplot2中aes中的参数(x, y 除外)基本都会生成图例来解释图形, 比如 fill, colour, linetype, shape. 基本箱线图(带有图例

highcharts图表的图例legend怎么改变显示位置

一.将图例Legend放于图表右侧1.设置chart的marginRight属性值:chart: { marginRight: 120}2.设置legend图例属性值如下 legend: { align: 'right', //水平方向位置 verticalAlign: 'top', //垂直方向位置 x: 0, //距离x轴的距离 y: 100 //距离Y轴的距离} 3.效果图: 二.将图例放于图表左上角1.设置legend的属性legend: { align: 'left', //水平方向位

fusioncharts图例(legend)属性

图例用来在多系列图和混合图中将图形和对应的系列名称联系起来. 从v3.2开始,每个系列的名称前面会展示对应的icon图标,这些图标具有交互作用,用户可以通过点击这些图标来显示或者隐藏对应的数据. 参数 说明 取值 renderAs 数据在图表中展现的方式 Area/Line showLegend 在饼图和环状图中使用图例 1/0 legendPosition 图例的位置 RIGHT/BOTTOM legendIconScale 图例的ICON图标的尺寸 0–5 当有很多图例要展示,然后空间不足的

ASP.NET MVC3 实例(六) 增加、修改和删除操作(二)

http://www.jquery001.com/asp.net-mvc3-instance-add-update-delete2.html 上篇我们在 ASP.NET MVC3 中实现了添加操作,由于时间关系没有完成修改.删除操作,我们新建了一个名为"Contact"的 Controller,并实现了添加方法,下边就让我们在此基础上来完成 ASP.NET MVC3 中的修改和删除操作. 首先,我们在 Contact 控制器类中添加一个名为 View()的方法,用来从 Contact

ASP.NET 操作Cookie详解 增加,修改,删除

Cookie,有时也用其复数形式Cookies,指某些网站为了辨别用户身份而储存在用户本地终端上的数据(通常经过加密).定义于RFC2109.它是网景公司的前雇员Lou Montulli在1993年3月的发明. 服务器可以利用Cookies包含信息的任意性来筛选并经常性维护这些信息,以判断在HTTP传输中的状态.Cookies最典型的应用是判定注册用户是否已经登录网站,用户可能会得到提示,是否在下一次进入此网站时保留用户信息以便简化登录手续,这些都是Cookies的功用.另一个重要应用场合是“购

在linux中,如何增加、修改、删除、暂停和冻结用户名

在Linux中,如何增加.修改.删除.暂停和冻结用户名 在操作增加.修改和删除用户名前,先认识linux中两个最重要的文件,它们就是账号管理最重要文件"/etc/passwd"与"etc/shadow". 环境:windows 7 + virtualbox + fedora 15 KDE 1.认识"etc/passwd"文件 在命令行输入:vi /etc/passwd 打开/etc/passwd文件,如上图所示. 文件构造:每一行都代表一个账号,

JDBC增加、更新、删除数据

JDBC增加.更新.删除数据 st.executeUpdate(sql) 进行插入.更新.删除操作返回的是受影响的记录的条数 注意:输入的sql语句中,vachar类型记住加单引号 完整代码如下: public class JDBCTest { //建立连接 public static Connection getConnection(){ Connection conn=null; try { Class.forName("com.mysql.cj.jdbc.Driver").new