Evento ChartSheet.BeforeRightClick

Ocorre quando o Microsoft.Office.Tools.Excel.ChartSheet é clicado, antes que o padrão com o botão direito ação.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (em Microsoft.Office.Tools.Excel.dll)

Sintaxe

'Declaração
Event BeforeRightClick As ChartEvents_BeforeRightClickEventHandler
event ChartEvents_BeforeRightClickEventHandler BeforeRightClick

Exemplos

O exemplo de código a seguir demonstra um manipulador para o BeforeRightClick caixa de evento que exibe uma mensagem quando o atual Microsoft.Office.Tools.Excel.ChartSheet é right-clicked. O exemplo também define o Cancel parâmetro do manipulador de eventos para true para que a folha de gráfico não recebe a ação do botão direito do mouse.

Private Sub DisallowRightClicks()
    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_BeforeRightClick(ByRef Cancel As Boolean) _
    Handles Me.BeforeRightClick
    MsgBox("Right-clicking this chart sheet is not allowed.")
    Cancel = True
End Sub
private void DisallowRightClicks()
{
    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.BeforeRightClick +=
        new Excel.ChartEvents_BeforeRightClickEventHandler(
        ChartSheet1_BeforeRightClick);
}

void ChartSheet1_BeforeRightClick(ref bool Cancel)
{
    MessageBox.Show("Right-clicking this chart sheet is not allowed.");
    Cancel = true;
}

Segurança do .NET Framework

Consulte também

Referência

ChartSheet Interface

Namespace Microsoft.Office.Tools.Excel