vba09-01.txt

来自「本书给出了AO的常用的VAB代码 可能是初学者很好的一本参考书」· 文本 代码 · 共 29 行

TXT
29
字号
Public Sub MakeLayerVisible()
  Dim pMxDocument As IMxDocument
  Dim pMap As IMap
  Dim pFeatureLayer As IFeatureLayer
  Dim pActiveView As IActiveView
  Dim pContentsView As IContentsView
  
  ' Access the first feature layer on the map
  Set pMxDocument = ThisDocument
  Set pMap = pMxDocument.FocusMap
  Set pFeatureLayer = pMap.Layer(0)
  
  ' If the feature layer is not visible,
  ' then make it visible.
  If Not pFeatureLayer.Visible Then
    pFeatureLayer.Visible = True
  End If
  
  ' Refresh the map.
  Set pActiveView = pMap
  pActiveView.Refresh
  
  ' Refresh the table of contents.
  Set pContentsView = pMxDocument. _
  CurrentContentsView
  pContentsView.Refresh pFeatureLayer
End Sub

⌨️ 快捷键说明

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