Share via


DocumentBase.ActivateEvent 이벤트

문서가 활성 창이 될 때 발생합니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word.v4.0.Utilities(Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

구문

‘선언
Public Event ActivateEvent As WindowEventHandler
public event WindowEventHandler ActivateEvent

설명

ActivateEvent 이벤트는 응용 프로그램 내에서 포커스를 이동한 경우에만 발생합니다. 포커스를 다른 응용 프로그램의 개체로 이동하거나 다른 응용 프로그램의 개체로부터 포커스가 이동해 온 경우에는 이벤트가 트리거되지 않습니다.

예제

다음 코드 조각은 문서가 활성화될 때 메시지를 표시합니다. 이 예제를 사용하려면 문서 수준 프로젝트 ThisDocument 클래스에서 실행하십시오.

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

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DocumentBase 클래스

Microsoft.Office.Tools.Word 네임스페이스