Udostępnij za pośrednictwem


Zdarzenie DocumentBase.ActivateEvent

Występuje, gdy dokument staje się oknem aktywnym.

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 ActivateEvent As WindowEventHandler
public event WindowEventHandler ActivateEvent

Uwagi

ActivateEvent Zdarzenie występuje tylko przy przenoszeniu fokusu w obrębie aplikacji.Przeniesienie fokusu do lub z obiektu w innej aplikacji nie powoduje wyzwolenia zdarzenia.

Przykłady

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

Private Sub DocumentActivateEvent()
    AddHandler Me.ActivateEvent, AddressOf ThisDocument_ActivateEvent
End Sub

Private Sub ThisDocument_ActivateEvent(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    MessageBox.Show("The document has been activated")
End Sub
private void DocumentActivateEvent()
{
    this.ActivateEvent += new Microsoft.Office.Tools.Word.WindowEventHandler(ThisDocument_ActivateEvent);
}

void ThisDocument_ActivateEvent(object sender, Microsoft.Office.Tools.Word.WindowEventArgs e)
{
    MessageBox.Show("The document has been activated");
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DocumentBase Klasa

Przestrzeń nazw Microsoft.Office.Tools.Word