📄 properties.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Properties"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Description = "Properties\\nProperties"
Option Explicit
'Private mobjGeoApp As Object
Private mobjGeoViewListeners As Object
'WIZARD: Modeless
Private mbImDone As Boolean
'ENDWIZARD
'WIZARD: MapViewListener
Dim MyMapViews As New Collection
Private MyEventServerObject As Object
'ENDWIZARD
Property Get IsDone() As Boolean
'WIZARD: Modeless
'Modeless commands must manage the IsDone property so the command manager
'will know whether or not your modeless command is still actively listening
'at some window.
IsDone = mbImDone
'ENDWIZARD
End Property
Sub Initialize(ByVal objApplication As Object, ByVal objViewListeners As Object)
'The Initialize method is called once per command server creation.
'Save the pointer to the Application object and the View Listeners object.
'The application object is the top of application's automation model.
' Set gobjGeoApp = objApplication
Set gobjGeoApp = objApplication
Set mobjGeoViewListeners = objViewListeners
'WIZARD: MapViewListener
Set MyEventServerObject = objApplication.CreateService("GeoMedia.EventServer")
'ENDWIZARD
'WIZARD: Modeless
'Modeless commands must manage the IsDone property so the command manager
'will know whether or not your modeless command is still actively listening
'at some window.
mbImDone = True
'ENDWIZARD
'WIZARD: HasForm
'Show the command's GUI on each activation.
Load frmProperties
'ENDWIZARD
End Sub
Sub Activate()
'WIZARD: MapViewListener
Dim mbNewActivation As Boolean
If mbImDone Then
'The command is not active, do full startup.
mbNewActivation = True
Else
'The command is already active, do re-enter actions.
mbNewActivation = False
End If
'ENDWIZARD
'WIZARD: Modeless
'Modeless commands must set the IsDone property to False for each Activate.
'The IsDone property should be set to True when the command is finished or
'whenever the Deactivate method is called.
mbImDone = False
'ENDWIZARD
'WIZARD: ModalWithForm
''Show the command's GUI on each activation.
'WIZARD: CenterOnApp
'Call CenterForm(gobjGeoApp.AppMainhWnd, frmProperties)
'ENDWIZARD
'WIZARD: CenterOnScreen
'Call CenterForm(0, frmProperties)
'ENDWIZARD
'frmProperties.Show 1
'ENDWIZARD
'WIZARD: MapViewListener
'Register this command with the view listeners manager.
'Get a pointer to the active map view
Dim objActiveView As Object
Dim objMapView As Object
Dim I As Long
If mbNewActivation Then
For I = 1 To gobjGeoApp.Windows.Count
Set objActiveView = gobjGeoApp.Windows.Item(I)
If objActiveView.Type = "MapWindow" Then
mobjGeoViewListeners.Add objActiveView, Me
'Connect to the Map View through the event control.
Set objMapView = objActiveView.MapView
frmProperties.EventControl1.AddMapView objMapView, MyEventServerObject
'Add this to my private collection of attached view windows
MyMapViews.Add objActiveView
End If
Next
Set objActiveView = Nothing
Set objMapView = Nothing
Else
'Command is already active, just manage collisions
For I = 1 To MyMapViews.Count
Set objActiveView = MyMapViews.Item(I)
'Try to add the view through the view listeners manager.
'It is the attempt to add which causes the other conflicting
'map view listener commands to either be removed or forced to
'ignore events.
mobjGeoViewListeners.Add objActiveView, Me
Next
Set objActiveView = Nothing
End If
'ENDWIZARD
'NOTE TO COMMAND WRITER: Insert your activation code here.
'WIZARD: Modeless
'If your code self-terminates during processing, be sure to call
'Deactivate on yourself or do the equivalent clean-up.
'ENDWIZARD
End Sub
Function CanDeactivate(ByVal objViewWindow As Object) As Boolean
CanDeactivate = True
End Function
Function CanEnable() As Boolean
'WIZARD: CustomEnablingRequirements
''Since you specified that this command has custom enabling requirements
''you must insert the code here that determines whether or not you are
''ready to run now.
'ENDWIZARD
CanEnable = True
End Function
Function CanActivate() As Boolean
'WIZARD: HasCustomStartupRequirements
''Since you specified that this map view listener command has custom activation
''requirements, you must insert the code here that determines whether or not you are
''able to startup given the current state of the listeners list.
'Dim I As Long
'Dim objViewWindow As Object
'Dim objCurCommand As Object
'Dim lCommandType As Long
'Dim lListenerMask As Long
''Get each of the map listeners
'For I = 1 To mobjGeoViewListeners.Count
'mobjGeoViewListeners.GetListener I, objViewWindow, objCurCommand, lCommandType, lListenerMask
''Add code here to process this map view listener.
'Next
'ENDWIZARD
CanActivate = True
End Function
Sub Deactivate()
'WIZARD: MapViewListener
Dim I As Long
Dim objActiveView As Object
For I = 1 To MyMapViews.Count
Set objActiveView = MyMapViews.Item(1)
'Unregister this command with the view listeners manager.
mobjGeoViewListeners.Remove objActiveView, Me
'Disconnect to the Map View through the event control.
frmProperties.EventControl1.RemoveMapView objActiveView.MapView
'Remove this window from my private list.
MyMapViews.Remove 1
Next
'ENDWIZARD
'WIZARD: Modeless
'Modeless commands must set the IsDone property to True
'whenever the Deactivate method is called.
mbImDone = True
'ENDWIZARD
End Sub
Sub AddView(ByVal objViewWindow As Object)
'WIZARD: MapViewListener
'Add this map view window to my collection.
MyMapViews.Add objViewWindow
'Register this command with the view listeners manager.
mobjGeoViewListeners.Add objViewWindow, Me
'Connect to the Map View through the event control.
frmProperties.EventControl1.AddMapView objViewWindow.MapView, MyEventServerObject
'ENDWIZARD
End Sub
Sub RemoveView(ByVal objViewWindow As Object)
'WIZARD: MapViewListener
'Find this view in our private list and remove it.
Dim I As Long
Dim objActiveView As Object
For I = 1 To MyMapViews.Count
Set objActiveView = MyMapViews.Item(I)
If objActiveView Is objViewWindow Then
MyMapViews.Remove I
Exit For
End If
Next
Set objActiveView = Nothing
'Unregister this command with the view listeners manager.
mobjGeoViewListeners.Remove objViewWindow, Me
'Disconnect to the Map View through the event control.
frmProperties.EventControl1.RemoveMapView objViewWindow.MapView
If MyMapViews.Count = 0 Then
'Since the last view was removed, we need to go inactive.
mbImDone = True
End If
'ENDWIZARD
End Sub
Sub IgnoreEvents(ByVal objViewWindow As Object)
'WIZARD: MapViewListener
'Temporarily disconnect to the Map View through the event control.
frmProperties.EventControl1.RemoveMapView (objViewWindow.MapView)
'ENDWIZARD
End Sub
Sub RestoreEvents(ByVal objViewWindow As Object)
'WIZARD: MapViewListener
'Reconnect to the Map View through the event control.
frmProperties.EventControl1.AddMapView objViewWindow.MapView, MyEventServerObject
'ENDWIZARD
End Sub
Sub Terminate()
'Perform any shutdown cleanup activities before we are released.
' let go local copies of application ptr and ViewListeners ptr
Set gobjGeoApp = Nothing
Set mobjGeoViewListeners = Nothing
'WIZARD: MapViewListener
Set MyEventServerObject = Nothing
Set MyMapViews = Nothing
'ENDWIZARD
'WIZARD: HasForm
'Show the command's GUI on each activation.
Unload frmProperties
'ENDWIZARD
End Sub
Function Help() As Boolean
Help = False
'WIZARD: Help
' There are three places a command can handle help
' 1) Help on a modal dialog can be handled in Form_KeyUp event
' 2) Help for Map View Listener can be handled in EventControl_KeyDown event
' This is for cases when the map view listener command is running and user
' presses the F1 key.
' 3) Context sensitive help, i.e, help when a user presses F1 or Shift F1 on the
' command's menu item or toolbar button. This method handles the 3rd case.
' Allow commands to show context sensitive help
' return TRUE if help is shown by the command
'Dim lngStatus As Long
'Dim lngHelpContextID As Long
' Assign a value to lngHelpContextID before passing on to WinHelp
'lngStatus = WinHelp(0, "xyz.hlp", HELP_CONTEXT, lngHelpContextID)
'If (lngStatus) Then
'Help = True
'End If
'ENDWIZARD
End Function
Sub NotifyStartModal()
'WIZARD: MapViewListener
'This method is called to notify that a Modal command is being started
End Sub
Sub NotifyEndModal()
'WIZARD: MapViewListener
'This method is called to notify that a Modal command has finished processing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -