DocumentBase.ActivateEvent 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在文档变成活动窗口时发生。
public event Microsoft.Office.Tools.Word.WindowEventHandler ActivateEvent;
事件类型
示例
激活文档时,以下代码段将显示一条消息。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。
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");
}
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
注解
ActivateEvent仅当你将焦点移到应用程序中时,才会发生此事件。 将焦点移到另一个应用程序中的某个对象或从该对象移开不会触发该事件。