Udostępnij za pośrednictwem


Zdarzenie Document.Deactivate

Występuje, gdy okna aktywnego dokumentu traci fokus.

Przestrzeń nazw:  Microsoft.Office.Tools.Word
Zestawy:   Microsoft.Office.Tools.Word.v4.0.Utilities (w Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Word (w Microsoft.Office.Tools.Word.dll)

Składnia

'Deklaracja
Event Deactivate As WindowEventHandler
event WindowEventHandler Deactivate

Uwagi

Deactivate Zdarzenie zachodzi, gdy zwolnisz dokumentu.

Przykłady

Poniższy przykład kodu wyświetla komunikat, gdy dokument jest aktywny.Ten przykład dotyczy dodatek programu poziomu aplikacji.

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");
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

Document Interfejs

Przestrzeń nazw Microsoft.Office.Tools.Word