Compartilhar via


Evento ChartSheetBase.BeforeRightClick

Ocorre quando Microsoft.Office.Tools.Excel.ChartSheetBase é clique com o botão direito do mouse, antes que a opção clique com o botão direito do mouse na ação.

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

Sintaxe

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

Exemplos

O exemplo de código a seguir demonstra um manipulador para o evento de BeforeRightClick que exibe uma caixa de mensagem quando Microsoft.Office.Tools.Excel.ChartSheetBase atual é clique com o botão direito do mouse. O exemplo também define o parâmetro de Cancel manipulador de eventos a true de modo que a folha do gráfico não receber a ação clique com o 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

ChartSheetBase Classe

Namespace Microsoft.Office.Tools.Excel