屏蔽Ribbon右键弹出菜单

方法一:
重载OnShowPopupMenu虚函数

BOOL CMainFrame::OnShowPopupMenu(CMFCPopupMenu* pMenuPopup)
{
 // TODO: 在此添加专用代码和/或调用基类
 return 0;
 //return CFrameWndEx::OnShowPopupMenu(pMenuPopup);
}

方法二:

继承CMFCRibbonBar类

重载virtual BOOL OnShowRibbonContextMenu(CWnd* pWnd, int x, int y, CMFCRibbonBaseElement* pHit);函数
BOOL CMyRibbonBar::OnShowRibbonContextMenu(CWnd* pWnd, int x, int y, CMFCRibbonBaseElement* pHit)
{
 ///这里可以添加自己的代码,以弹出自定义菜单
 return TRUE;
}          
即可去掉右键弹出菜单
 
 

猜你喜欢

转载自blog.csdn.net/fcxzqz/article/details/44219679