_dispVCProjectEngineEvents.ItemAdded 方法

此 API 支持 .NET Framework 基础结构,不适合在代码中直接使用。

指示已将指定项添加到项目中。

命名空间:  Microsoft.VisualStudio.VCProjectEngine
程序集:  Microsoft.VisualStudio.VCProjectEngine(在 Microsoft.VisualStudio.VCProjectEngine.dll 中)

语法

声明
Sub ItemAdded ( _
    Item As Object, _
    ItemParent As Object _
)
void ItemAdded(
    Object Item,
    Object ItemParent
)
void ItemAdded(
    [InAttribute] Object^ Item, 
    [InAttribute] Object^ ItemParent
)
abstract ItemAdded : 
        Item:Object * 
        ItemParent:Object -> unit 
function ItemAdded(
    Item : Object, 
    ItemParent : Object
)

参数

备注

ItemAdded 激发时,向项目中添加 VCProjectVCFilterVCFile

示例

[Visual Basic]

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub ItemAdded(ByVal item As Object, ByVal parent As Object)
        Dim vcitem As VCProjectItem
        vcitem = item
        MsgBox(vcitem.ItemName)
    End Sub

    Sub Main()
        Dim projEngine As VCProjectEngine
        Dim evt As VCProjectEngineEvents
        Dim prj As VCProject
        projEngine = DTE.Solution.Projects.Item(1).Object.VCProjectEngine
        prj = DTE.Solution.Projects.Item(1).Object
        evt = projEngine.Events
        AddHandler evt.ItemAdded, AddressOf ItemAdded
        prj.AddFile("myfile")
    End Sub
End Module

.NET Framework 安全性

请参见

参考

_dispVCProjectEngineEvents 接口

Microsoft.VisualStudio.VCProjectEngine 命名空间