I am using the Microsoft Ax Framer Control to view the word document in the Visual C# Form.
After Hosting(Open) the Word Document in the Ax Framer Control.
While Right Click on the Word Document, Ms word Context Menu is Appearing.
I Want to Hide this Pop up Menu.
I set
Word.Document wddoc = (Word.Document)axFramerControl1.ActiveDocument;
Word.Application wordApp = wddoc.Application;
wordApp.WindowBeforeRightClick += new ApplicationEvents4_WindowBeforeRightClickEventHandler(wordApp_WindowBeforeRightClick);
to handle RightClick. But The application doesn't run
wordApp_WindowBeforeRightClick
event.
What's the problem?
void wordApp_WindowBeforeRightClick(Selection Sel, ref bool Cancel)
{
Cancel = true;
AddContextMenu();
}
private void AddContextMenu()
{
Word.Document wddoc = (Word.Document)axFramerControl1.ActiveDocument;
Word.Application wordApp = wddoc.Application;
Office.CommandBar ContextMenu = wordApp.CommandBars.Add("ContextMenu",
Office.MsoBarPosition.msoBarPopup, Type.Missing, true);
if (ContextMenu != null)
{
Office.CommandBarPopup cpp =
(Office.CommandBarPopup)ContextMenu.Controls.Add
(Office.MsoControlType.msoControlPopup,Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
cpp.Caption = "SubMenu";
Office.CommandBarButton cbHello1 =
(Office.CommandBarButton)cpp.Controls.Add
(Office.MsoControlType.msoControlButton, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
cbHello1.Caption = "Hello1";
ContextMenu.ShowPopup(Type.Missing, Type.Missing);
}
}