0

如何禁用某些菜单,如剪切、粘贴、在AxOWC11.AxSpreadsheet右键菜单中插入新行/列,我正在使用下面的代码,但没有从中得到正确的解决方案

void spreadSheet_BeforeContextMenu(object sender, 
                         AxOWC11.ISpreadsheetEventSink_BeforeContextMenuEvent e)
{
    //Here i am getting all the menu items but not able to disable it....
    //e.menu
}
4

1 回答 1

0

通过使用以下事件,我的问题解决了

private void spreadSheet_BeforeContextMenu(object sender, AxOWC11.ISpreadsheetEventSink_BeforeContextMenuEvent e) 
{ 
 e.cancel.Value = true; 
} 

private void spreadSheet_StartEdit(object sender, AxOWC11.ISpreadsheetEventSink_StartEditEvent e) 
{ 
 e.cancel.Value = true; 
} 

private void spreadSheet_BeforeKeyDown(object sender, AxOWC11.ISpreadsheetEventSink_BeforeKeyDownEvent e) 
{ 
 if (e.keyCode != 67)//Ctrl + C 
 { 
  e.cancel.Value = true; 
 }
}
于 2012-10-26T12:10:34.270 回答