⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsgobacktopreviousextent.cls

📁 arcEngine开发地图放大缩小漫游控件,fr
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 1  'Persistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "GoBackToPreviousExtent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True

' Copyright 2006 ESRI
' 							  
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See use restrictions at /arcgis/developerkit/userestrictions.

Option Explicit

Private m_pHookHelper As IHookHelper
Private m_pBitmap As IPictureDisp

Implements ICommand

'Constant used by the Error handler function - DO NOT REMOVE

Private Sub Class_Initialize()

  'Load resources
  Set m_pBitmap = LoadResPicture("UnDoDrawExtent", vbResBitmap)
  Set m_pHookHelper = New HookHelper

End Sub

Private Sub Class_Terminate()

  'Clear variables
  Set m_pHookHelper = Nothing
  Set m_pBitmap = Nothing
  
End Sub

Private Property Get ICommand_Enabled() As Boolean

  If (m_pHookHelper.FocusMap Is Nothing) Then Exit Property
  
  'Get the active view
  Dim pActiveView As esriCarto.IActiveView
  Set pActiveView = m_pHookHelper.FocusMap
  'Get the extent stack
  Dim pMapStack As esriCarto.IExtentStack
  Set pMapStack = pActiveView.ExtentStack
  'Can the extent be undone
  ICommand_Enabled = pMapStack.CanUndo

End Property
 
Private Property Get ICommand_Checked() As Boolean

  ICommand_Checked = False

End Property
 
Private Property Get ICommand_Name() As String

  ICommand_Name = "Sample_Pan/Zoom_Undo Extent"

End Property

Private Property Get ICommand_Caption() As String

  ICommand_Caption = "Undo Extent"

End Property
 
Private Property Get ICommand_Tooltip() As String

  ICommand_Tooltip = "Draw Previous Extent"

End Property
 
Private Property Get ICommand_Message() As String

  ICommand_Message = "Goto Previous Screen location"

End Property
 
Private Property Get ICommand_HelpFile() As String

  ' TODO: Add your implementation here

End Property
 
Private Property Get ICommand_HelpContextID() As Long

  ' TODO: Add your implementation here

End Property
 
Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE

  ICommand_Bitmap = m_pBitmap

End Property
 
Private Property Get ICommand_Category() As String

  ICommand_Category = "Sample_Pan/Zoom"

End Property
 
Private Sub ICommand_OnCreate(ByVal hook As Object)

  Set m_pHookHelper.hook = hook

End Sub
 
Private Sub ICommand_OnClick()

  'Get the active view
  Dim pActiveView As esriCarto.IActiveView
  Set pActiveView = m_pHookHelper.FocusMap
  'Get the extent stack
  Dim pMapExtent As esriCarto.IExtentStack
  Set pMapExtent = pActiveView.ExtentStack
  'Undo the extent
  If pMapExtent.CanUndo Then
    pMapExtent.undo
  End If

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -