pageLayoutControl与Mapcontrol同步(VB)

Option Explicit

Implements esriCarto.IMaps

Public m_Collection As Collection

Private Sub Class_Initialize()

  Set m_Collection = New Collection

End Sub

'----------------IMaps接口的方法及属性的实现--------------------

'得到collection中的元素的个数

Private Property Get IMaps_Count() As Long

  IMaps_Count = m_Collection.count

End Property

'通过指定索引得到map

Private Property Get IMaps_Item(ByVal mapIndex As Long) As IMap

  If mapIndex > m_Collection.count Or mapIndex < 0 Then

    MsgBox "BSMaps::Item:\r\n索引超出界限!"

    Exit Property

  End If

  Set IMaps_Item = m_Collection.Item(mapIndex + 1)

End Property

'向集合中添加map对象

Private Sub IMaps_Add(ByVal map As IMap)

  If isNull(map) Or map Is Nothing Then

    MsgBox "Maps::Add:\r\n对象还没有初始化!"

    Exit Sub

  End If

  m_Collection.Add map

End Sub

'新建一个Map对象

Private Function IMaps_Create() As IMap

  Dim newMap As IMap

  Set newMap = New map

  m_Collection.Add newMap

  Set IMaps_Create = newMap

End Function

'清除collection中所有元素

Private Sub IMaps_reset()

  Dim idx As Integer

  For idx = 1 To m_Collection.count

    m_Collection.Remove idx

  Next idx

End Sub

'通过指定索引移除map

Private Sub IMaps_remove(ByVal map As IMap)

  If mapIndex > m_Collection.count Or mapIndex <= 0 Then

    MsgBox "BSMaps::RemoveAt:\r\n索引超出界限!"

    Exit Sub

  End If

  m_Collection.Remove mapIndex

End Sub

Private Sub IMaps_removeAt(ByVal idx As Long)

'

End Sub

posted @ 2010-02-28 16:26  iLocationStudio  阅读(341)  评论(0编辑  收藏  举报