Condividi tramite


Evento ChartSheet.BeforeDoubleClick (System 2007)

Aggiornamento: novembre 2007

Si verifica quando si fa doppio clic sull'oggetto Microsoft.Office.Tools.Excel.ChartSheet prima dell'azione di doppio clic predefinita.

Spazio dei nomi:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Sintassi

Public Event BeforeDoubleClick As ChartEvents_BeforeDoubleClickEventHandler

Dim instance As ChartSheet
Dim handler As ChartEvents_BeforeDoubleClickEventHandler

AddHandler instance.BeforeDoubleClick, handler
public event ChartEvents_BeforeDoubleClickEventHandler BeforeDoubleClick

Note

Questo evento non si verifica con il metodo DoubleClick.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato un gestore per l'evento BeforeDoubleClick che visualizza una finestra di messaggio quando viene fatto doppio clic su un asse dell'oggetto Microsoft.Office.Tools.Excel.ChartSheet corrente. Nell'esempio viene inoltre impostato su true il parametro Cancel del gestore eventi affinché il foglio grafico non riceva l'azione di doppio clic quando l'utente fa doppio clic su un asse.

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

Autorizzazioni

Vedere anche

Riferimenti

ChartSheet Classe

Membri ChartSheet

Spazio dei nomi Microsoft.Office.Tools.Excel