Compartir a través de


Document.WindowSize (Evento)

Se produce cuando se cambia el tamaño de la ventana de documento o cuando se mueve.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word (en Microsoft.Office.Tools.Word.dll)

Sintaxis

'Declaración
Event WindowSize As WindowEventHandler
event WindowEventHandler WindowSize

Ejemplos

En el ejemplo de código siguiente se crea un controlador para el evento WindowSize. El controlador de eventos muestra en el título de la ventana el número de veces que se ha cambiado el tamaño de la ventana. Se trata de un ejemplo para un complemento en el nivel de la aplicación.

Private resizeCount As Integer = 0
Private Sub DocumentWindowSize()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.WindowSize, AddressOf ThisDocument_WindowSize
End Sub

Private Sub ThisDocument_WindowSize(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    resizeCount += 1
    e.Window.Caption = "Window resized " & resizeCount.ToString() & " times."
End Sub
int resizeCount = 0;
private void DocumentWindowSize()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.WindowSize +=
        new Microsoft.Office.Tools.Word.WindowEventHandler(
        ThisDocument_WindowSize);
}

void ThisDocument_WindowSize(object sender,
    Microsoft.Office.Tools.Word.WindowEventArgs e)
{
    resizeCount++;
    e.Window.Caption = "Window resized " +
        resizeCount.ToString() + " times.";
}

Seguridad de .NET Framework

Vea también

Referencia

Document Interfaz

Microsoft.Office.Tools.Word (Espacio de nombres)