右键弹出菜单

来源:互联网 发布:php简单数据库源代码 编辑:程序博客网 时间:2024/04/28 06:15

 void CLeftView::OnRButtonDown(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
 
 CTreeView::OnRButtonDown(nFlags, point);

   CMenu PopMenu;
  CMenu *pMenu;
  CPoint pt;
  pt= point;
  
  PopMenu.LoadMenu(IDR_EDIT); //菜单ID
  ClientToScreen(&pt);
  pMenu = PopMenu.GetSubMenu(0);
  pMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,
   pt.x,pt.y,this);

}

原创粉丝点击