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
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Przy użyciu bibliotek z częściowo zaufanego kodu..