WorkbookBase.SheetBeforeDoubleClick 事件

在双击任意工作表之后,默认的双击操作之前发生。

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

语法

声明
Public Event SheetBeforeDoubleClick As WorkbookEvents_SheetBeforeDoubleClickEventHandler
public event WorkbookEvents_SheetBeforeDoubleClickEventHandler SheetBeforeDoubleClick

备注

此事件不会发生于图表工作表上。

示例

下面的代码示例演示 SheetBeforeDoubleClick 事件的处理程序。该事件处理程序通知用户不允许双击工作表,然后将 WorkbookEvents_SheetBeforeDoubleClickEventHandler 事件处理程序的 Cancel 参数设置为 true,以便 Microsoft Office Excel 取消该双击操作。

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

Sub ThisWorkbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
    ByVal Target As Excel.Range, ByRef Cancel As Boolean) _
    Handles Me.SheetBeforeDoubleClick

    MsgBox("Double-clicking in " & CType(Sh, Excel.Worksheet).Name & _
        " is not allowed.")
    Cancel = True
End Sub
private void WorkbookSheetBeforeDoubleClick()
{
    this.SheetBeforeDoubleClick +=
        new Excel.WorkbookEvents_SheetBeforeDoubleClickEventHandler(
        ThisWorkbook_SheetBeforeDoubleClick);
}

void ThisWorkbook_SheetBeforeDoubleClick(object Sh,
    Excel.Range Target, ref bool Cancel)
{
    MessageBox.Show("Double-clicking in " + ((Excel.Worksheet)Sh).Name +
        " is not allowed.");
    Cancel = true;
}

.NET Framework 安全性

请参见

参考

WorkbookBase 类

Microsoft.Office.Tools.Excel 命名空间