Share via


ChartSheet.BeforeDoubleClick Event (2007 System)

Occurs when the Microsoft.Office.Tools.Excel.ChartSheet is double-clicked, before the default double-click action.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Event BeforeDoubleClick As ChartEvents_BeforeDoubleClickEventHandler
'Usage
Dim instance As ChartSheet 
Dim handler As ChartEvents_BeforeDoubleClickEventHandler 

AddHandler instance.BeforeDoubleClick, handler
public event ChartEvents_BeforeDoubleClickEventHandler BeforeDoubleClick
public:
 event ChartEvents_BeforeDoubleClickEventHandler^ BeforeDoubleClick {
    void add (ChartEvents_BeforeDoubleClickEventHandler^ value);
    void remove (ChartEvents_BeforeDoubleClickEventHandler^ value);
}
JScript does not support events.

Remarks

The DoubleClick method does not cause this event to occur.

Examples

The following code example demonstrates a handler for the BeforeDoubleClick event that displays a message box when an axis of the current Microsoft.Office.Tools.Excel.ChartSheet is double-clicked. The example also sets the Cancel parameter of the event handler to true so that the chart sheet does not receive the double click action when the user double-clicks an axis.

Private Sub DisallowDoubleClicksOnAxis()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ChartType = Excel.XlChartType.xl3DColumn
End Sub 

Sub ChartSheet1_BeforeDoubleClick(ByVal ElementID As Integer, _
    ByVal Arg1 As Integer, ByVal Arg2 As Integer, _
    ByRef Cancel As Boolean) Handles Me.BeforeDoubleClick
    If ElementID = Fix(Excel.XlChartItem.xlAxis) Then
        MsgBox("Formatting this axis is not allowed.")
        Cancel = True 
    End If 
End Sub
private void DisallowDoubleClicksOnAxis()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ChartType = Excel.XlChartType.xl3DColumn;

    this.BeforeDoubleClick +=
        new Excel.ChartEvents_BeforeDoubleClickEventHandler(
        ChartSheet1_BeforeDoubleClick);
}

void ChartSheet1_BeforeDoubleClick(int ElementID, int Arg1, 
    int Arg2, ref bool Cancel)
{
    if (ElementID == (int)Excel.XlChartItem.xlAxis)
    {
        MessageBox.Show("Formatting this axis is not allowed.");
        Cancel = true;
    }
}

.NET Framework Security

See Also

Reference

ChartSheet Class

ChartSheet Members

Microsoft.Office.Tools.Excel Namespace