YouTube | Facebook | Twitter  Feed

カタログ ウィンドウの指定したパスを展開

2016/9/1 (木)

public void ExpandSelecetdTreeNode()
{
    IGxApplication gxApplication = default(IGxApplication);
    gxApplication = Application;
 
    IGxTreeView gxTreeView = default(IGxTreeView);
    gxTreeView = gxApplication.TreeView;
 
    IGxView gxView = default(IGxView);
    gxView = gxTreeView;
 
    //If you want to select the location.
    gxApplication.Location = "C:\\Users\\Administrator\\Documents\\ArcGIS";
 
    IGxObjectContainer gxSelectedContainer = default(IGxObjectContainer);
    gxSelectedContainer = gxApplication.SelectedObject;
 
    IEnumGxObject gxObjects = default(IEnumGxObject);
    gxObjects = gxSelectedContainer.Children;
    if (gxObjects == null)
        return;
    gxObjects.Reset();
 
    IGxObject gxChildObject = default(IGxObject);
    gxChildObject = gxObjects.Next;
 
    IGxSelection gxSelection = default(IGxSelection);
    gxSelection = new gxSelection();
    gxSelection.SetLocation(gxChildObject, null);
    gxSelection.Select(gxChildObject, false, null);
 
    gxTreeView.EnsureVisible(gxChildObject);
 
    gxView.Refresh();
 
}
Sub ExpandSelecetdTreeNode()
    Dim gxApplication As IGxApplication
    Set gxApplication = Application
     
    Dim gxTreeView As IGxTreeView
    Set gxTreeView = gxApplication.TreeView
     
    Dim gxView As IGxView
    Set gxView = gxTreeView
     
    'If you want to select the location.
    gxApplication.Location = "C:\Users\Administrator\Documents\ArcGIS"
     
    Dim gxSelectedContainer As IGxObjectContainer
    Set gxSelectedContainer = gxApplication.SelectedObject
 
    Dim gxObjects As IEnumGxObject
    Set gxObjects = gxSelectedContainer.Children
    If gxObjects Is Nothing Then Exit Sub
    gxObjects.Reset
     
    Dim gxChildObject As IGxObject
    Set gxChildObject = gxObjects.Next
     
    Dim gxSelection As IGxSelection
    Set gxSelection = New gxSelection
    Call gxSelection.SetLocation(gxChildObject, Nothing)
    Call gxSelection.Select(gxChildObject, False, Nothing)
 
    Call gxTreeView.EnsureVisible(gxChildObject)
     
    Call gxView.Refresh
     
End Sub

関連記事

  • この記事を書いた人

羽田 康祐

Esri認定インストラクター、GIS上級技術者、測量士補、潜水士。GISy / GISc とその関連分野である地理学・地図学について日々の出来事で学んだ記憶を記録するためにブログを書いています。行動原理は伊達と酔狂。好きな地形は圏谷。好きな地図投影法はパースクインカンシャル図法。呉市生まれ広島市出身。GIS を使った自己紹介はこちら

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

© 2020 WINGFIELD since1981