WindowEventArgs 介面

提供 ActivateEventDeactivate,以及 WindowSize 事件的資訊。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word (在 Microsoft.Office.Tools.Word.dll 中)

語法

'宣告
<GuidAttribute("767d9ec0-c72c-4f66-892b-be4a4b20eba3")> _
Public Interface WindowEventArgs
[GuidAttribute("767d9ec0-c72c-4f66-892b-be4a4b20eba3")]
public interface WindowEventArgs

WindowEventArgs 型別會公開下列成員。

屬性

  名稱 說明
公用屬性 Window 可藉由 ActivateEventDeactivate 以及 WindowSize 的方法來取得作用中的視窗。

回頁首

範例

下列程式碼範例中,會建立 WindowSize 事件的事件處理常式。 此事件處理常式會在視窗標題中顯示已調整視窗大小的次數。

這是示範文件層級自訂的範例。

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

請參閱

參考

Microsoft.Office.Tools.Word 命名空間