Sdílet prostřednictvím


WindowEventArgs.Window Property

Definition

Gets the window being acted upon by the ActivateEvent, Deactivate, and WindowSize methods.

public:
 property Microsoft::Office::Interop::Word::Window ^ Window { Microsoft::Office::Interop::Word::Window ^ get(); };
public Microsoft.Office.Interop.Word.Window Window { get; }
member this.Window : Microsoft.Office.Interop.Word.Window
Public ReadOnly Property Window As Window

Property Value

The window being acted upon by the ActivateEvent, Deactivate, and WindowSize methods.

Examples

The following code example creates an event handler for the WindowSize event. The event handler uses the Window property to display in the window caption the number of times that the window has been resized.

This example is for a document-level customization.

int resizeCount = 0;
private void DocumentWindowSize()
{
    this.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.";
}
Private resizeCount As Integer = 0
Private Sub DocumentWindowSize()
    AddHandler Me.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

Applies to