欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap 谈天说地
   您现在位于: 首页技术专栏ArcGIS应用与开发AO开发 → 正文
要素的标注
07-12-04 00:00:00 作者:浩淼的天空 出处:浩淼的天空
标注有两种方法,一个是添加TextElement到文档对象,另一种是基于要素的某个属性进行标注,它需要载入数据支持。第一种方法在P8中可以看到。下面介绍后一种方法:
Public sub Anno(byval pGeoFeatLyr as iGeofeaturelayer,byval field as string)
   Dim pGeoFeatLayer As IGeoFeatureLayer
pGeoFeatLayer = pGeoFeatLyr
        Dim pAnnoProps As IannotateLayerPropertiesCollection             
        pAnnoProps = pGeoFeatLyr.AnnotationProperties
        pAnnoProps.Clear()              必须执行这个语句,否则里面会默认有一个pAnnoLayerProps
        Dim pAnnoLayerProps As IAnnotateLayerProperties
        Dim pPosition As ILineLabelPosition
        Dim pPlacement As ILineLabelPlacementPriorities
        Dim pBasic As IBasicOverposterLayerProperties
        Dim pLabelEngine As ILabelEngineLayerProperties
        Dim pTextSyl As ItextSymbol        标注的文字格式,注意
        pTextSyl = New TextSymbol
        Dim pFont As stdole.StdFont
        pFont = New stdole.StdFont
        pFont.Name = "verdana"
        pFont.Size = 5
        pTextSyl.Font = pFont
        pTextSyl.Color = HSVColor(250, 160, 200)
        pPosition = New LineLabelPosition
        pPosition.Parallel = False
        pPosition.Perpendicular = True
        pPlacement = New LineLabelPlacementPriorities
        pBasic = New BasicOverposterLayerProperties
        pBasic.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolyline
        pBasic.LineLabelPlacementPriorities = pPlacement
        pBasic.LineLabelPosition = pPosition
        pLabelEngine = New LabelEngineLayerProperties
        pLabelEngine.Symbol = pTextSyl
        pLabelEngine.BasicOverposterLayerProperties = pBasic
        pLabelEngine.Expression = field         field必须是这个样子——"[STATE_NAME]"
        pAnnoLayerProps = pLabelEngine
        pAnnoProps.Add(pAnnoLayerProps)
        pGeoFeatLyr.DisplayAnnotation = True
    AxMapControl.CtlRefresh(esriViewDrawPhase.esriViewBackground)
End sub
消除标注的方法也很简单,由于pGeoFeatLyr是一个全局变量,我们只要设置如下代码即可:
        pGeoFeatLyr.DisplayAnnotation = False
     AxMapControl.CtlRefresh(esriViewDrawPhase.esriViewBackground)

(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  

    关于我们 友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.

                   滇ICP备05006901号