共用方式為


_dispVCProjectEngineEvents.ItemMoved Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Signifies that the specified item was moved within the project.

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Syntax

'宣告
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
)

Parameters

Remarks

The ItemMoved method fires when an item is moved in a VCProject, VCFilter, or VCFile object.

Examples

[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 Security

See Also

Reference

_dispVCProjectEngineEvents Interface

Microsoft.VisualStudio.VCProjectEngine Namespace