Share via


Document.Deactivate-Ereignis

Wird ausgelöst, wenn das aktive Dokumentfenster den Fokus verliert.

Namespace:  Microsoft.Office.Tools.Word
Assemblys:   Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
Event Deactivate As WindowEventHandler
event WindowEventHandler Deactivate

Hinweise

Das Deactivate-Ereignis wird nicht ausgelöst, wenn Sie das Dokument entladen.

Beispiele

Im folgenden Codebeispiel wird eine Meldung angezeigt, wenn das Dokument deaktiviert wird.Dieses Beispiel bezieht sich auf ein Add-In auf Anwendungsebene.

Private Sub DocumentDeactivate()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.Deactivate, AddressOf ThisDocument_Deactivate
End Sub

Private Sub ThisDocument_Deactivate(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    System.Windows.Forms.MessageBox.Show("The document has been deactivated")
End Sub
private void DocumentDeactivate()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.Deactivate += new Microsoft.Office.Tools.Word.WindowEventHandler(ThisDocument_Deactivate);
}

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

.NET Framework-Sicherheit

Siehe auch

Referenz

Document Schnittstelle

Microsoft.Office.Tools.Word-Namespace