Udostępnij za pośrednictwem


Zdarzenie DocumentBase.CloseEvent

Występuje, gdy dokument jest zamykany.

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

Składnia

'Deklaracja
Public Event CloseEvent As DocumentEvents2_CloseEventHandler
public event DocumentEvents2_CloseEventHandler CloseEvent

Przykłady

Poniższy przykład kodu wyświetla komunikat, gdy dokument jest zamykany.Aby wykorzystać ten przykład, należy uruchomić go z ThisDocument klasy w projekcie na poziomie dokumentu.

Private Sub DocumentCloseEvent()
    AddHandler Me.CloseEvent, AddressOf ThisDocument_CloseEvent
End Sub
Sub ThisDocument_CloseEvent()
    MessageBox.Show("The document is closing.")
End Sub
private void DocumentCloseEvent()
{
    this.CloseEvent += new Microsoft.Office.Interop.Word.DocumentEvents2_CloseEventHandler(ThisDocument_CloseEvent);
}

void ThisDocument_CloseEvent()
{
    MessageBox.Show("The document is closing.");
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DocumentBase Klasa

Przestrzeń nazw Microsoft.Office.Tools.Word