允许访问扩展性模型中的所有事件。 还可以从扩展性模型内的特定对象公开事件。
命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)
语法
声明
<GuidAttribute("134170F8-93B1-42DD-9F89-A2AC7010BA07")> _
Public Interface Events
[GuidAttribute("134170F8-93B1-42DD-9F89-A2AC7010BA07")]
public interface Events
[GuidAttribute(L"134170F8-93B1-42DD-9F89-A2AC7010BA07")]
public interface class Events
[<GuidAttribute("134170F8-93B1-42DD-9F89-A2AC7010BA07")>]
type Events =  interface end
public interface Events
Events 类型公开以下成员。
属性
| 名称 | 说明 | |
|---|---|---|
| .gif) | BuildEvents | 获取 BuildEvents 对象,该对象提供解决方案生成事件。 | 
| .gif) | CommandBarEvents | 获取一个对象,该对象提供在单击提供的 CommandBarControl 对象时引发的事件。 | 
| .gif) | CommandEvents | 获取指定命令的 CommandEvents。 | 
| .gif) | DebuggerEvents | 获取提供调试器中的事件的对象。 | 
| .gif) | DocumentEvents | 获取为文档提供事件的 DocumentEvents。 | 
| .gif) | DTEEvents | 获取 DTEEvents,它为开发环境提供事件。 | 
| .gif) | FindEvents | 获取 Find 操作的 FindEvents。 | 
| .gif) | MiscFilesEvents | 获取解决方案的 ProjectItemsEvents。 | 
| .gif) | OutputWindowEvents | 获取窗口事件的 OutputWindowEvents。 | 
| .gif) | SelectionEvents | 获取选定内容的 SelectionEvents。 | 
| .gif) | SolutionEvents | 获取解决方案的 SolutionEvents 对象。 | 
| .gif) | SolutionItemsEvents | 获取解决方案的 ProjectItemsEvents 对象。 | 
| .gif) | TaskListEvents | 获取开发环境的 TaskListEvents。 | 
| .gif) | TextEditorEvents | 获取 IDE 的 TextEditorEvents 对象。 | 
| .gif) | WindowEvents | 获取 WindowEvents 对象,该对象提供开发环境中的窗口的事件。 | 
页首
方法
| 名称 | 说明 | |
|---|---|---|
| .gif) | GetObject | 获取后期绑定到 DTE 对象的接口或对象,并且在运行时可通过名称访问。 | 
页首
备注
自动化模型包含一个根 Events 对象,以任何语言编写的自动化客户端可以从该对象引用自动化事件,例如 SolutionEvents。
各种 IDE 工具、项目类型、编辑器等都可以将附加的事件添加到各自专用的 Events 对象。 例如,Visual C++ 添加 VCProjectItemsEvents 属性。
示例
Public Module Module1
   Dim WithEvents bldevents As BuildEvents
   Dim applicationObject As EnvDTE.DTE
   Sub EventsExample()
      Dim addInInstance As EnvDTE.AddIn
      applicationObject = CType(Application, EnvDTE.DTE)
      bldevents = CType(applicationObject.Events.BuildEvents, EnvDTE.BuildEvents)
   End Sub
   Private Sub bldevents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles bldevents.OnBuildDone
      MsgBox("Build complete")
   End Sub
End Module