Private Sub 添加书签ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加书签ToolStripMenuItem.Click
Dim pMapBookMarks As IMapBookmarks
pMapBookMarks = Me.AxMapControl1.ActiveView.FocusMap
Dim pAOIBookMark As IAOIBookmark
pAOIBookMark = New AOIBookmark
pAOIBookMark.Location = Me.AxMapControl1.ActiveView.Extent
pMapBookMarks.AddBookmark(pAOIBookMark)
End Sub
Private Sub 定位书签ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 定位书签ToolStripMenuItem.Click
Dim pMapBookMarks As IMapBookmarks
pMapBookMarks = Me.AxMapControl1.ActiveView.FocusMap
Dim pEnumSpatialBM As IEnumSpatialBookmark
pEnumSpatialBM = pMapBookMarks.Bookmarks
Dim pSpatialBM As ISpatialBookmark
'在这里定位到的是第一个书签
pSpatialBM = pEnumSpatialBM.Next
pSpatialBM.ZoomTo(Me.AxMapControl1.ActiveView.FocusMap)
Me.AxMapControl1.ActiveView.Refresh()
End Sub
Private Sub 删除指定书签ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 删除指定书签ToolStripMenuItem.Click
Dim pMapBookMarks As IMapBookmarks
pMapBookMarks = Me.AxMapControl1.ActiveView.FocusMap
Dim pEnumSpatialBM As IEnumSpatialBookmark
pEnumSpatialBM = pMapBookMarks.Bookmarks
Dim pSpatialBM As ISpatialBookmark
'在这里删除的是第一个书签
pSpatialBM = pEnumSpatialBM.Next
pMapBookMarks.RemoveBookmark(pSpatialBM)
End Sub
Private Sub 删除全部书签ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 删除全部书签ToolStripMenuItem.Click
Dim pMapBookMarks As IMapBookmarks
pMapBookMarks = Me.AxMapControl1.ActiveView.FocusMap
pMapBookMarks.RemoveAllBookmarks()
End Sub
需要注意的是:当我们删除某一个标签时,标签队列中该标签以后的所有标签都将依次往前移动一位,总标签数目将减少一个;
此时定位标签时,已被删除标签前的标签序号不变,已被删除标签后的标签序号将减少一个