默认头像
路人甲
路人甲
  • 注册日期2003-11-01
  • 发帖数139
  • QQ
  • 铜币522枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2069回复:1

删除比例尺等地图修饰就报错

楼主#
更多 发布于:2006-04-17 18:00

我在程序中想删除原来在ArcMap中生成的比例尺等地图修饰元素,但是总是报错,程序就崩溃了……(pGraphContainer.DeleteElement pElement)

后来我改一下测试的代码如下,错是不会报了,但是结果比例尺删的只剩一个单位“米”了,我又改变了一下元素的大小,已经删除的比例尺标注,横线又回来了,等于没删

帮忙啊,搞了几天了

     Do While Not pElement Is Nothing
       If TypeOf pElement Is MapSurroundFrame Then     '如果是地图修饰
           Dim pElementPro As IElementProperties2
           Set pElementPro = pElement
10
           Dim pMapSurroundFrame As IMapSurroundFrame
           Dim pGraphicsComposite As IGraphicsComposite
           Dim pEnumEle As IEnumElement, pEle As IElement
   
           Set pMapSurroundFrame = pElement
           Set pGraphicsComposite = pMapSurroundFrame
   
           Set pEnumEle = pGraphicsComposite.Graphics(GetActiveView.ScreenDisplay, Nothing)    '?图形化拆分元素
           pEnumEle.Reset
           Set pEle = pEnumEle.Next
20
           Do Until pEle Is Nothing
               If TypeOf pEle Is GroupElement Then
                   Dim pGroupEle As IGroupElement      '组元素
                   Set pGroupEle = pEle
                   pGroupEle.ClearElements
30
               Else
                   pGraphContainer.DeleteElement pEle  '一般元素
               End If
               Set pEle = pEnumEle.Next
           Loop
       End If
40

[此贴子已经被作者于2006-4-17 20:14:40编辑过]
喜欢0 评分0
人生在世,及时行乐 QQ:35291086 E-Mail:hushuyong@163.com
默认头像
路人甲
路人甲
  • 注册日期2009-04-23
  • 发帖数7
  • QQ
  • 铜币125枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2009-07-22 11:04
举报 回复(0) 喜欢(0)     评分
默认头像

返回顶部