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 命名空间