共用方式為


_dispVCProjectEngineEvents.ItemMoved 方法

這個 API 支援 .NET Framework 基礎結構,但您不可以直接在程式碼中使用它。

表示指定的項目已在專案內移動。

命名空間:  Microsoft.VisualStudio.VCProjectEngine
組件:  Microsoft.VisualStudio.VCProjectEngine (在 Microsoft.VisualStudio.VCProjectEngine.dll 中)

語法

'宣告
Sub ItemMoved ( _
    Item As Object, _
    NewParent As Object, _
    OldParent As Object _
)
void ItemMoved(
    Object Item,
    Object NewParent,
    Object OldParent
)
void ItemMoved(
    [InAttribute] Object^ Item, 
    [InAttribute] Object^ NewParent, 
    [InAttribute] Object^ OldParent
)
abstract ItemMoved : 
        Item:Object * 
        NewParent:Object * 
        OldParent:Object -> unit 
function ItemMoved(
    Item : Object, 
    NewParent : Object, 
    OldParent : Object
)

參數

  • OldParent
    型別:System.Object
    必要項。先前的父代。

備註

ItemMoved 方法時,就會引發項目移至 VCProjectVCFilterVCFile 物件。

範例

[Visual Basic]

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

Public Module Module1
    Sub ItemMoved(ByVal item As Object, ByVal newParent As Object, _
        ByVal oldParent As Object)
        Dim vcitem As VCProjectItem
        vcitem = item
        MsgBox(vcitem)
    End Sub

    Sub Main()
        Dim projEngine As VCProjectEngine
        Dim evt As VCProjectEngineEvents
        Dim prj As VCProject
        Dim col As IVCCollection
        Dim file As VCFile
        Dim folder As VCFilter
        projEngine = DTE.Solution.Projects.Item(1).Object.VCProjectEngine
        prj = DTE.Solution.Projects.Item(1).Object
        evt = projEngine.Events
        AddHandler evt.ItemMoved, AddressOf ItemMoved
        col = prj.Items
        folder = col.Item("Resource Files")
        file = col.Item("ReadMe.txt")
        file.Move(folder)
    End Sub
End Module

.NET Framework 安全性

請參閱

參考

_dispVCProjectEngineEvents 介面

Microsoft.VisualStudio.VCProjectEngine 命名空間