ChartSheetBase.BeforeRightClick Event


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

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

public event ChartEvents_BeforeRightClickEventHandler BeforeRightClick

The following code example demonstrates a handler for the BeforeRightClick event that displays a message box when the current Microsoft.Office.Tools.Excel.ChartSheetBase is right-clicked. The example also sets the Cancel parameter of the event handler to true so that the chart sheet does not receive the right click action.

private void DisallowRightClicks()
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

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

    this.BeforeRightClick +=
        new Excel.ChartEvents_BeforeRightClickEventHandler(

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