_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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。