去搜了下 找不到的人还真不少
vc6.0下的mfc添加组件的两部操作 1.单击Project~Add to Project~Components and Controls
2.双击Visual C++ Components目录,选择Pop_up Menu组件 vc2008我找不到怎么去添加 Pop_up Menu组件了~~帮帮忙呀~~谢谢
vc6.0下的mfc添加组件的两部操作 1.单击Project~Add to Project~Components and Controls
2.双击Visual C++ Components目录,选择Pop_up Menu组件 vc2008我找不到怎么去添加 Pop_up Menu组件了~~帮帮忙呀~~谢谢
{
// CG: This block was added by the Pop-up Menu component//Pop-Up Menu在代码上就添加了下面的这段
{
if (point.x == -1 && point.y == -1){
//keystroke invocation
CRect rect;
GetClientRect(rect);
ClientToScreen(rect); point = rect.TopLeft();
point.Offset(5, 5);
} CMenu menu;
VERIFY(menu.LoadMenu(CG_IDR_POPUP_ABOUT_DLG)); CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD)
pWndPopupOwner = pWndPopupOwner->GetParent(); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
pWndPopupOwner);
}
}接下来你只需要建立一个ID为CG_IDR_POPUP_ABOUT_DLG的菜单就行了。
void CMyF1Dlg::OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/ )
只需要把.h文件和.cpp文件对应的位置都改成:
void CMyF1Dlg::OnContextMenu(CWnd* pWnd, CPoint point)
就可以了。