XmlMappedRange.BeforeDoubleClick 事件 (2007 系統)

更新:2007 年 11 月

在按兩下 XmlMappedRange 控制項時 (在預設的按兩下動作前) 發生。

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

語法

Public Event BeforeDoubleClick As DocEvents_BeforeDoubleClickEventHandler

Dim instance As XmlMappedRange
Dim handler As DocEvents_BeforeDoubleClickEventHandler

AddHandler instance.BeforeDoubleClick, handler
public event DocEvents_BeforeDoubleClickEventHandler BeforeDoubleClick

範例

下列程式碼範例展示 BeforeDoubleClick 事件的處理常式,此處理常式會取消 XmlMappedRange 中的按兩下動作。事件處理常式會告知使用者不允許 XmlMappedRange 的按兩下動作,然後將 DocEvents_BeforeDoubleClickEventHandler 事件處理常式的 Cancel 參數設定為 true,令 Microsoft Office Excel 取消按兩下動作。此程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange

Sub CustomerLastNameCell_BeforeDoubleClick(ByVal Target As Excel.Range, _
    ByRef Cancel As Boolean) Handles CustomerLastNameCell.BeforeDoubleClick
    MsgBox("Double-clicking in this range is not allowed.")
    Cancel = True
End Sub
private void XmlMappedRange_BeforeDoubleClick()
{
    this.CustomerLastNameCell.BeforeDoubleClick += 
        new Excel.DocEvents_BeforeDoubleClickEventHandler(
        CustomerLastNameCell_BeforeDoubleClick);
}

void CustomerLastNameCell_BeforeDoubleClick(Excel.Range Target, 
    ref bool Cancel)
{
    MessageBox.Show("Double-clicking in this range " +
        " is not allowed.");
    Cancel = true;
}

使用權限

請參閱

參考

XmlMappedRange 類別

XmlMappedRange 成員

Microsoft.Office.Tools.Excel 命名空間