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

📄 clearfeatureselection.cls

📁   本书是作者使用ArcObjects进行项目开发以及在ArcObjects授课中经验的总结
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ClearFeatureSelection"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private m_pHookHelper As esriControlCommands.IHookHelper
Private m_pBitmap As IPictureDisp

Implements esriSystemUI.ICommand

Private Sub Class_Initialize()
  Set m_pBitmap = LoadResPicture("ClearSelection", vbResBitmap)
  Set m_pHookHelper = New HookHelper
End Sub

Private Sub Class_Terminate()
  Set m_pBitmap = Nothing
  Set m_pHookHelper = Nothing
End Sub

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

Private Property Get ICommand_Enabled() As Boolean
  If (m_pHookHelper.FocusMap Is Nothing) Then Exit Property
  ICommand_Enabled = (m_pHookHelper.FocusMap.SelectionCount > 0)
End Property
 
Private Property Get ICommand_Checked() As Boolean
  ICommand_Checked = False
End Property
 
Private Property Get ICommand_Name() As String
  ICommand_Name = "Sample_Select(VB6)_Clear Feature Selection"
End Property

Private Property Get ICommand_Caption() As String
  ICommand_Caption = "Clear Feature Selection"
End Property
 
Private Property Get ICommand_Tooltip() As String
  ICommand_Tooltip = "Clear Feature Selection"
End Property
 
Private Property Get ICommand_Message() As String
  ICommand_Message = "Clear Current Feature Selection"
End Property
 
Private Property Get ICommand_HelpFile() As String
  ' Not used
End Property
 
Private Property Get ICommand_HelpContextID() As Long
  ' Not used
End Property
  
Private Property Get ICommand_Category() As String
  ICommand_Category = "Sample_Select(VB6)"
End Property
 
Private Sub ICommand_OnCreate(ByVal hook As Object)
  Set m_pHookHelper.hook = hook
End Sub
 
Private Sub ICommand_OnClick()

  'Clear selection
  m_pHookHelper.FocusMap.ClearSelection
  
  'Get the IActiveView of the FocusMap
  Dim pActiveView As esriCarto.IActiveView
  Set pActiveView = m_pHookHelper.FocusMap
  
  'Get the visible extent of the display
  Dim pBounds As esriGeometry.IEnvelope
  Set pBounds = pActiveView.ScreenDisplay.DisplayTransformation.FittedBounds
  
  'Refresh the visible extent of the display
  pActiveView.PartialRefresh esriViewGeoSelection, Nothing, pBounds

End Sub

⌨️ 快捷键说明

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