Hi
Although, we can handle the WindowBeforeRightClick event and set Cancel
=true to cancel the right click to prevent the word menu in the word window.
But the Winform's context menu can only be shown when the form is visible.
The information below is just for your information.
private void
wdApp_WindowBeforeRightClick(Microsoft.Office.Interop.Word.Selection Sel,
ref bool Cancel)
{
try
{
Debug.WriteLine("wdApp_WindowBeforeRightClick");
Form1 fm = new Form1();
fm.Show();
fm.ShowMenu(Cursor.Position);
// fm.Show();
// fm.Visible = false;
// fm.ContextMenu.Show(fm,Cursor.Position);
//fm.Close();
Cancel = true;
}
catch(Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.