DocumentBase.Deactivate 事件

當現用文件視窗失去焦點時發生。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public Event Deactivate As WindowEventHandler
public event WindowEventHandler Deactivate

備註

當您卸載文件時,不會發生 Deactivate 事件。

範例

下列程式碼範例會在停用文件時顯示訊息。若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

Private Sub DocumentDeactivate()
    AddHandler Me.Deactivate, AddressOf ThisDocument_Deactivate
End Sub

Private Sub ThisDocument_Deactivate(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    MessageBox.Show("The document has been deactivated")
End Sub
private void DocumentDeactivate()
{
    this.Deactivate += new Microsoft.Office.Tools.Word.WindowEventHandler(ThisDocument_Deactivate);
}

void ThisDocument_Deactivate(object sender, Microsoft.Office.Tools.Word.WindowEventArgs e)
{
    MessageBox.Show ("The document has been deactivated");
}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間