Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Occurs when the editing area of the document window is right-clicked, before the default right-click action.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Syntax
'Declaration
Event BeforeRightClick As ClickEventHandler
event ClickEventHandler BeforeRightClick
Remarks
To prevent the default right-click action from occurring, set the Cancel argument of the provided CancelEventArgs object to true.
Examples
The following code example displays a message when you right-click the document. This example is for an application-level add-in.
Private Sub DocumentBeforeRightClick()
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
AddHandler vstoDoc.BeforeRightClick, AddressOf ThisDocument_BeforeRightClick
End Sub
Private Sub ThisDocument_BeforeRightClick(ByVal sender As Object, ByVal e _
As Microsoft.Office.Tools.Word.ClickEventArgs)
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
System.Windows.Forms.MessageBox.Show(vstoDoc.Name & " was right-clicked.")
e.Cancel = True
End Sub
private void DocumentBeforeRightClick()
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.BeforeRightClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeRightClick);
}
void ThisDocument_BeforeRightClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
System.Windows.Forms.MessageBox.Show(vstoDoc.Name + " was right-clicked.");
e.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.