DocumentBase.Shutdown 事件
在文档宿主项关闭时发生。
命名空间: Microsoft.Office.Tools.Word
程序集: Microsoft.Office.Tools.Word.v4.0.Utilities(在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
声明
Public Event Shutdown As EventHandler
public event EventHandler Shutdown
这是在项目中卸载文档宿主项时引发的最后一个事件。 将此事件用于任何其他清理过程。 当文档宿主项关闭时,将卸载程序集的应用程序域。
下面的代码示例添加一个新的 Shutdown 事件处理程序,该处理程序显示一条指出要关闭文档的消息。 若要使用此示例,请从文档级项目内的 ThisDocument 类中运行此示例。
Private Sub DocumentShutdown()
AddHandler Me.Shutdown, AddressOf ThisDocument_Shutdown2
End Sub
Private Sub ThisDocument_Shutdown2(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show("The Shutdown event was raised.")
End Sub
private void DocumentShutdown()
{
this.Shutdown +=new EventHandler(ThisDocument_Shutdown2);
}
private void ThisDocument_Shutdown2(object sender, System.EventArgs e)
{
MessageBox.Show("The Shutdown event was raised.");
}
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。