共用方式為


ProjectItem 介面

更新:2007 年 11 月

代表專案中的一個項目。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

<GuidAttribute("0B48100A-473E-433C-AB8F-66B9739AB620")> _
Public Interface ProjectItem

Dim instance As ProjectItem
[GuidAttribute("0B48100A-473E-433C-AB8F-66B9739AB620")]
public interface ProjectItem
[GuidAttribute(L"0B48100A-473E-433C-AB8F-66B9739AB620")]
public interface class ProjectItem
public interface ProjectItem

範例

' Before running, create a new project or open an existing project.
Sub ListProj()
   Dim proj As Project = DTE.ActiveSolutionProjects(0)
   Dim win As Window = _
     DTE.Windows.Item(Constants.vsWindowKindCommandWindow)
   ListProjAux(proj.ProjectItems(), 0)
End Sub

Sub ListProjAux(ByVal projitems As ProjectItems, ByVal Level As Integer)
   Dim projitem As ProjectItem
   For Each projitem In projitems
      MsgBox("Project item: " & projitem.Name, Level)
      ' Recurse if the project item has sub-items...
      Dim projitems2 As ProjectItems
      projitems2 = projitem.ProjectItems
      Dim notsubcoll As Boolean = projitems2 Is Nothing
      If Not notsubcoll Then
         ListProjAux(projitems2, Level + 1)
      End If
   Next
End Sub

請參閱

參考

ProjectItem 成員

EnvDTE 命名空間

其他資源

控制專案與方案