Compartilhar via


XmlMappedRange.BeforeDoubleClick Event

Definition

Occurs when an XmlMappedRange control is double-clicked, before the default double-click action.

public:
 event Microsoft::Office::Interop::Excel::DocEvents_BeforeDoubleClickEventHandler ^ BeforeDoubleClick;
event Microsoft.Office.Interop.Excel.DocEvents_BeforeDoubleClickEventHandler BeforeDoubleClick;
member this.BeforeDoubleClick : Microsoft.Office.Interop.Excel.DocEvents_BeforeDoubleClickEventHandler 
Event BeforeDoubleClick As DocEvents_BeforeDoubleClickEventHandler 

Event Type

Examples

The following code demonstrates a handler for the BeforeDoubleClick event that cancels the double-click action in an XmlMappedRange. The event handler informs the user that double-clicking is not allowed for the XmlMappedRange, and then sets the Cancel parameter of the DocEvents_BeforeDoubleClickEventHandler event handler to true so that Microsoft Office Excel cancels the double-click action. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

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

Applies to