ChartSheet.BeforeRightClick Event (2007 System)
Occurs when the Microsoft.Office.Tools.Excel.ChartSheet is right-clicked, before the default right-click action.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public Event BeforeRightClick As ChartEvents_BeforeRightClickEventHandler
'Usage
Dim instance As ChartSheet
Dim handler As ChartEvents_BeforeRightClickEventHandler
AddHandler instance.BeforeRightClick, handler
public event ChartEvents_BeforeRightClickEventHandler BeforeRightClick
public:
event ChartEvents_BeforeRightClickEventHandler^ BeforeRightClick {
void add (ChartEvents_BeforeRightClickEventHandler^ value);
void remove (ChartEvents_BeforeRightClickEventHandler^ value);
}
JScript does not support events.
Examples
The following code example demonstrates a handler for the BeforeRightClick event that displays a message box when the current Microsoft.Office.Tools.Excel.ChartSheet 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 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;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.