如题。

解决方案 »

  1.   

    project->Add to Project->Compoment->Compomemt->Popup Menu
      

  2.   

    Easy,using CMenu::CreatePopupMenu() and CMenu::TrackPopupMenu() method you can do it ,a explame such like this:CMenu menu;
    menu.CreatePopupMenu();
    menu.AppendMenu(0,IDC_Test,"&Test");
    //add a splitter flag
    menu.AppendMenu(MF_GRAYED,0,"");//show it 
    CPoint point;
    GetCursorPos(&point);
    menu.trackPopupmenu();
      

  3.   

    最简单的方法是映射WM_CONTEXTMENU
    例如:
    void CMainFrame::OnContextMenu(CWnd* pWnd, CPoint point) 
    {
    // TODO: Add your message handler code here
        CMenu menu;
      menu.LoadMenu(IDR_MAINFRAME);
      CMenu *pMenu=menu.GetSubMenu(0);
      this->m_wndToolBar.ClientToScreen(&point);
      pMenu->TrackPopupMenu(TPM_LEFTBUTTON|TPM_LEFTALIGN,point.x,point.y,this);
               menu.Detach();

     }
      

  4.   

    当然了最好在视图中相应WM_CONTEXTMENU
      

  5.   

    I mailed a sample to you.