WorkbookBase.WindowDeactivate 事件

在停用任何工作簿窗口时发生。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel.v4.0.Utilities(在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

语法

声明
Public Event WindowDeactivate As WorkbookEvents_WindowDeactivateEventHandler
public event WorkbookEvents_WindowDeactivateEventHandler WindowDeactivate

示例

下面的代码示例演示 WindowDeactivate 事件的处理程序。该事件处理程序最小化被停用的工作簿窗口。

此示例针对的是文档级自定义项。

Private Sub ThisWorkbook_WindowDeactivate(ByVal Wn As Excel.Window) _
    Handles Me.WindowDeactivate
    Wn.WindowState = Excel.XlWindowState.xlMinimized
End Sub
private void WorkbookWindowDeactivate()
{
    this.WindowDeactivate +=
        new Excel.WorkbookEvents_WindowDeactivateEventHandler(
        ThisWorkbook_WindowDeactivate);
}

private void ThisWorkbook_WindowDeactivate(Excel.Window Wn)
{
    Wn.WindowState = Excel.XlWindowState.xlMinimized;
}

.NET Framework 安全性

请参见

参考

WorkbookBase 类

Microsoft.Office.Tools.Excel 命名空间