VSProjectEvents.ImportsEvents 属性

获取一个提供对 Imports 对象事件的访问的 ImportsEvents 对象。

命名空间:  VSLangProj
程序集:  VSLangProj(在 VSLangProj.dll 中)

语法

声明
ReadOnly Property ImportsEvents As ImportsEvents
    Get
ImportsEvents ImportsEvents { get; }
property ImportsEvents^ ImportsEvents {
    ImportsEvents^ get ();
}
abstract ImportsEvents : ImportsEvents
function get ImportsEvents () : ImportsEvents

属性值

类型:VSLangProj.ImportsEvents
返回 ImportsEvents 对象。

备注

ImportsEvents 对象提供对 ImportAddedImportRemoved 这两个事件的访问。

示例

此示例使用 Events 对象将事件处理方法连接到特定项目的 ImportAddedImportRemoved

' Macro editor
' This example adds event handlers to the two events in
' ImportsEvents.
Imports VSLangProj
Sub ImportAdded(ByVal addedImport As String)
   MsgBox("The import '" & addedImport & "' was added.")
End Sub

Sub ImportRemoved(ByVal removedImport As String)
   MsgBox("The import '" & removedImport & "' was removed.")
End Sub

Sub ConnectImportsEvents()
   Dim proj As Project = DTE.Solution.Projects.Item(1)
   Dim vsproj As VSProject = CType(proj.Object, VSProject)
   Dim impEvents As ImportsEvents = vsproj.Events.ImportsEvents
   AddHandler impEvents.ImportAdded, AddressOf ImportAdded
   AddHandler impEvents.ImportRemoved, AddressOf ImportRemoved
End Sub

.NET Framework 安全性

请参见

参考

VSProjectEvents 接口

VSLangProj 命名空间