[ArcEngine地图制图系列]—添加比例文本
2015-05-11 11:18
751 查看
private void AddScaleText(IActiveView pActiveView, IEnvelope pEnv)
{
try
{
IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = new MapSurroundFrameClass();
pMapSurroundFrame.MapFrame = pMapFrame;
IStyleGalleryItem pStyleGalleryItem = SymbolUtilty.GetItemFromServerStyle("Scale Texts", "Absolute Scale");
pMapSurroundFrame.MapSurround = (IMapSurround)pStyleGalleryItem.Item;
IElement pElement = axPageControl.FindElementByName("ScaleText");
if (pElement != null)
{
pGraphicsContainer.DeleteElement(pElement); //删除已经存在的比例尺
}
IElementProperties pElePro = null;
pElement = (IElement)pMapSurroundFrame;
pElement.Geometry = (IGeometry)pEnv;
pElePro = pElement as IElementProperties;
pElePro.Name = "ScaleText";
pGraphicsContainer.AddElement(pElement, 0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
{
try
{
IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = new MapSurroundFrameClass();
pMapSurroundFrame.MapFrame = pMapFrame;
IStyleGalleryItem pStyleGalleryItem = SymbolUtilty.GetItemFromServerStyle("Scale Texts", "Absolute Scale");
pMapSurroundFrame.MapSurround = (IMapSurround)pStyleGalleryItem.Item;
IElement pElement = axPageControl.FindElementByName("ScaleText");
if (pElement != null)
{
pGraphicsContainer.DeleteElement(pElement); //删除已经存在的比例尺
}
IElementProperties pElePro = null;
pElement = (IElement)pMapSurroundFrame;
pElement.Geometry = (IGeometry)pEnv;
pElePro = pElement as IElementProperties;
pElePro.Name = "ScaleText";
pGraphicsContainer.AddElement(pElement, 0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
相关文章推荐
- [ArcEngine地图制图系列]—添加地图标题
- [ArcEngine地图制图系列]—添加地图指北针
- [ArcEngine地图制图系列]—添加比例尺
- [ArcEngine地图制图系列]—添加网格
- supermap学习系列(七)——用户自己在地图上添加点、线、面标注
- arcEngine经典代码-添加气泡提示框(标注,文本,)
- arcEngine经典代码-添加气泡提示框(标注,文本,)
- ArcEngine 关于缩放至一定比例显示地图的问题
- ArcGIS制图技巧系列(3)—让地图更有立体感
- arcEngine经典代码-添加气泡提示框(标注,文本,)
- 【iOS百度地图系列_2】卫星图、交通图、热力图及在基本地图上添加覆盖物
- jQuery系列之添加元素或文本+jQ操作(六)
- 【地图整饰】ArcMap添加图框及ArcEngine实现
- itext7学习笔记杂谈系列3——在绝对位置添加文本
- ArcGIS教程:向带状地图添加动态文本
- google 地图,添加文本标注,可提交到数据库(更新,删除,修改)
- 【地图整饰】ArcMap添加地图标题及ArcEngine实现
- Windows Phone学习系列(二):地图相关应用开发(概念篇)
- iOS编程 界面布局 纯代码 VFL编写和添加 左右两个view,按比例设置大小