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

      2017/12/09

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

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