YouTube | Facebook | X(Twitter) | RSS

TOC の選択アイテムへのアクセス

2016/9/1 (木)

'TOC([コンテンツ] ウィンドウ)の選択アイテムへのアクセス
Public Sub ContentsView()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
     
    Dim pContentsView As IContentsView3
    Set pContentsView = pMxDocument.CurrentContentsView
     
    If TypeOf pContentsView.SelectedItem Is IMap Then
        Dim pMap As IMap
        se pMap = pContentsView.SelectedItem
     
    ElseIf TypeOf pContentsView.SelectedItem Is ILayer Then
        Dim pLayer As ILayer
        Set pLayer = pContentsView.SelectedItem
         
    ElseIf TypeOf pContentsView.SelectedItem Is ILegendGroup Then
        Dim pLegendGroup As ILegendGroup
        Set pLegendGroup = pContentsView.SelectedItem
         
    ElseIf TypeOf pContentsView.SelectedItem Is ILegendClass Then
        Dim pLegendClass As ILegendClass
        Set pLegendClass = pContentsView.SelectedItem
         
        Dim pSymbol As ISymbol
        Set pSymbol = pLegendClass.Symbol
         
    ElseIf TypeOf pContentsView.SelectedItem Is IWorkspace Then 'source view only
        Dim pWorkspace As IWorkspace
        Set pWorkspace = pContentsView.SelectedItem
     
    ElseIf TypeOf pContentsView.SelectedItem Is IDataset Then 'source view only
        Dim pDataset As IDataset
        Set pDataset = pContentsView.SelectedItem
     
    ElseIf TypeOf pContentsView.SelectedItem Is IStandaloneTable Then 'source view only
        Dim pStandaloneTable As IStandaloneTable
        Set pStandaloneTable = pContentsView.SelectedItem
         
    End If
 
End Sub
  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『"地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング, ArcGIS
-,