经过一番思考,在VS2005 里里应该没有POP_UP MENU控件,以下是两种实现方法(网上找的)
void CMy61popView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
/*CMenu menu;
menu.LoadMenu(IDR_MENU1);
CMenu *pmenu = menu.GetSubMenu(0);
ClientToScreen(&point);
pmenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);*/
//TPM_LEFTALIGN Positions the pop-up menu so that its left side is aligned with the coordinate specified by x
CMenu menu;
menu.LoadMenu(IDR_MENU1); //载入事先定义的选单
CMenu *pMenu=menu.GetSubMenu(0);
CPoint pos;
GetCursorPos(&pos);
pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pos.x+50, pos.y-20, AfxGetMainWnd() );
CView::OnRButtonDown(nFlags, point);
}