共用方式為


_dispVCProjectEngineEvents.ItemRenamed 方法

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

表示專案中的指定項目已重新命名。

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

語法

'宣告
Sub ItemRenamed ( _
    Item As Object, _
    ItemParent As Object, _
    OldName As String _
)
void ItemRenamed(
    Object Item,
    Object ItemParent,
    string OldName
)
void ItemRenamed(
    [InAttribute] Object^ Item, 
    [InAttribute] Object^ ItemParent, 
    [InAttribute] String^ OldName
)
abstract ItemRenamed : 
        Item:Object * 
        ItemParent:Object * 
        OldName:string -> unit 
function ItemRenamed(
    Item : Object, 
    ItemParent : Object, 
    OldName : String
)

參數

  • ItemParent
    型別:System.Object
    必要項。項目的父代。

備註

ItemRenamed 方法時,就會在項目 VCProjectVCFilterVCFile 物件。

範例

[Visual Basic]

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

Public Module Module1
    Sub ItemRenamed(ByVal item As Object, ByVal ItemParent As Object, ByVal OldName As String)
        Dim vcitem As VCProjectItem
        vcitem = item
        MsgBox(vcitem.ItemName)
    End Sub

    Sub Main()
        Dim projEngine As VCProjectEngine
        Dim evt As VCProjectEngineEvents
        Dim prj As VCProject
        Dim col As IVCCollection
        Dim folder As VCFilter
        prj = DTE.Solution.Projects.Item(1).Object
        projEngine = prj.VCProjectEngine
        col = prj.Filters
        evt = projEngine.Events
        AddHandler evt.ItemRenamed, AddressOf ItemRenamed
        folder = col.Item("MyFolder")
        folder.Name = "MyNewFolderName"
    End Sub
End Module

.NET Framework 安全性

請參閱

參考

_dispVCProjectEngineEvents 介面

Microsoft.VisualStudio.VCProjectEngine 命名空間