共用方式為


_dispVCProjectEngineEvents.ItemMoved(Object, Object, Object) Method

Definition

Signifies that the specified item was moved within the project.

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

public:
 void ItemMoved(System::Object ^ Item, System::Object ^ NewParent, System::Object ^ OldParent);
public:
 void ItemMoved(Platform::Object ^ Item, Platform::Object ^ NewParent, Platform::Object ^ OldParent);
void ItemMoved(winrt::Windows::Foundation::IInspectable const & Item, winrt::Windows::Foundation::IInspectable const & NewParent, winrt::Windows::Foundation::IInspectable const & OldParent);
[System.Runtime.InteropServices.DispId(278)]
public void ItemMoved (object Item, object NewParent, object OldParent);
[<System.Runtime.InteropServices.DispId(278)>]
abstract member ItemMoved : obj * obj * obj -> unit
Public Sub ItemMoved (Item As Object, NewParent As Object, OldParent As Object)

Parameters

Item
Object

Required. The item.

NewParent
Object

Required. The new parent.

OldParent
Object

Required. The previous parent.

Attributes

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  

Remarks

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

Applies to