_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
)
参数
- Item
类型:System.Object
必需。项。
- NewParent
类型:System.Object
必需。新的父级。
- OldParent
类型:System.Object
必需。先前的父项。
备注
ItemMoved 方法引发,该项目将 VCProject、VCFilter或 VCFile 对象。
示例
[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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。