UIHierarchyItems 接口

更新:2007 年 11 月

表示给定级别的 UI 层次结构树,它还表示树中选定项的集合。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
<GuidAttribute("DB8406B0-A916-449C-A277-BB04028F4394")> _
Public Interface UIHierarchyItems _
    Implements IEnumerable
用法
Dim instance As UIHierarchyItems
[GuidAttribute("DB8406B0-A916-449C-A277-BB04028F4394")]
public interface UIHierarchyItems : IEnumerable
[GuidAttribute(L"DB8406B0-A916-449C-A277-BB04028F4394")]
public interface class UIHierarchyItems : IEnumerable
public interface UIHierarchyItems extends IEnumerable

备注

有关使用 UIHierarchyItems 集合访问节点的替换方法,请参阅 UIHierarchy 对象。

示例

Sub UIHierarchyItemsExample()
   ' Reference the UIHierarchy, UIHierarchyItem, and OutputWindow objects.
   Dim UIH As UIHierarchy = _
     DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object
   Dim samples As UIHierarchyItem = UIH.GetItem("Macros\Samples")
   Dim OWPane As OutputWindowPane = GetOutputWindowPane("List Macros")
   Dim file As UIHierarchyItem

   OWPane.Clear()
   For Each file In samples.UIHierarchyItems
      OWPane.OutputString(file.Name &  _
        Microsoft.VisualBasic.Constants.vbCrLf)
      Dim macro As UIHierarchyItem
      For Each macro In file.UIHierarchyItems
         OWPane.OutputString("   " & macro.Name & _
           Microsoft.VisualBasic.Constants.vbCrLf)
      Next
   Next
End Sub

Function GetOutputWindowPane(ByVal Name As String, Optional ByVal show _
  As Boolean = True) As OutputWindowPane
   Dim win As Window = _
     DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
   If show Then win.Visible = True
   Dim ow As OutputWindow = win.Object
   Dim owpane As OutputWindowPane
   Try
      owpane = ow.OutputWindowPanes.Item(Name)
   Catch e As System.Exception
      owpane = ow.OutputWindowPanes.Add(Name)
   End Try
   owpane.Activate()
   Return owpane
End Function

另请参见

参考

UIHierarchyItems 成员

EnvDTE 命名空间

其他资源

如何:使用 UIHierarchy 操作树视图