Evento Document.WindowSize

Viene generato quando la finestra del documento viene ridimensionata o spostata.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Sintassi

'Dichiarazione
Event WindowSize As WindowEventHandler
event WindowEventHandler WindowSize

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come creare un gestore per l'evento WindowSize. Tramite il gestore eventi nel titolo della finestra viene visualizzato il numero di volte che la finestra è stata ridimensionata. Questo esempio è valido per un componente aggiuntivo a livello di applicazione.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Document Interfaccia

Spazio dei nomi Microsoft.Office.Tools.Word