Share via


ChartSheetBase.BeforeDoubleClick (Evento)

Se produce cuando se hace doble clic en el objeto Microsoft.Office.Tools.Excel.ChartSheetBase, antes de ejecutar la acción predeterminada de doble clic.

Espacio de nombres:  Microsoft.Office.Tools.Excel
Ensamblado:  Microsoft.Office.Tools.Excel.v4.0.Utilities (en Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintaxis

'Declaración
Public Event BeforeDoubleClick As ChartEvents_BeforeDoubleClickEventHandler
public event ChartEvents_BeforeDoubleClickEventHandler BeforeDoubleClick

Comentarios

El método DoubleClick no hace que se produzca este evento.

Ejemplos

El ejemplo de código siguiente muestra un controlador para el evento BeforeDoubleClick que muestra un cuadro de mensaje cuando se hace doble clic en un eje del objeto Microsoft.Office.Tools.Excel.ChartSheetBase actual. El ejemplo también establece el parámetro Cancel del controlador de eventos en true para que la hoja de gráficos no reciba la acción de doble clic cuando el usuario hace doble clic en un eje.

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

Seguridad de .NET Framework

Vea también

Referencia

ChartSheetBase Clase

Microsoft.Office.Tools.Excel (Espacio de nombres)