clsextension.cls

来自「这是一个非常全的VB+AO二次开发实例集」· CLS 代码 · 共 53 行

CLS
53
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsExtension"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True

 Option Explicit
 Implements IExtension
 
 Dim m_pApp As IApplication
 ' Need to listen for the MxDocument events
 Dim WithEvents m_pDoc As MxDocument
Attribute m_pDoc.VB_VarHelpID = -1
 
 Private Property Get IExtension_Name() As String
     IExtension_Name = "My Extension"
 End Property
 
 Private Sub IExtension_Shutdown()
     ' Clear the reference to the Application and MxDocument
     Set m_pApp = Nothing
     Set m_pDoc = Nothing
 End Sub
 
 Private Sub IExtension_Startup(initializationData As Variant)
     ' This extension is an ArcMap Extension. When this extension in loaded on
     ' ArcMap startup, initializationData is passed in as a reference to the
     ' Application object
     Set m_pApp = initializationData
     
     'Start listening for the MxDocument events.
     Set m_pDoc = m_pApp.Document
 End Sub
 
 Private Function m_pDoc_NewDocument() As Boolean
     ' Do something when a new document is created
     MsgBox "Creating a new document."
 End Function
 
 Private Function m_pDoc_OpenDocument() As Boolean
     ' So something when a document is opened.
     MsgBox "Opening a document"
 End Function
 

⌨️ 快捷键说明

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