YouTube | Facebook | X(Twitter) | RSS

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

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
  • この記事を書いた人

羽田 康祐

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

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