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