Share via


Document.WindowSize-Ereignis

Wird ausgelöst, wenn die Größe des Dokumentfensters angepasst oder das Dokumentfenster verschoben wird.

Namespace:  Microsoft.Office.Tools.Word
Assemblys:   Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
Event WindowSize As WindowEventHandler
event WindowEventHandler WindowSize

Beispiele

Im folgenden Codebeispiel wird ein Handler für das WindowSize-Ereignis erstellt.Der Ereignishandler zeigt in der Fensterbeschriftung an, wie oft die Größe des Fensters angepasst wurde.Dieses Beispiel bezieht sich auf ein Add-In auf Anwendungsebene.

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

.NET Framework-Sicherheit

Siehe auch

Referenz

Document Schnittstelle

Microsoft.Office.Tools.Word-Namespace