Floating Pop-Up Menus

 
Floating Pop-Up Menus是在用戶接口設計中最新傾向之一,就是右擊出來個菜單供用戶選擇的那種。
使用步驟:
  1. Use the menu editor to insert a new, empty menu in your project's resource file.
  2. Type some characters in the left top-level item, and then add your menu items in the resulting pop-up menu.
  3. Use ClassWizard to add a WM_CONTEXTMENU message handler in your view class or in some other window class that receives mouse-click messages. Code the handler as shown below.
    void CMyView::OnContextMenu(CWnd *pWnd, CPoint point)
    {
        CMenu menu;
        menu.LoadMenu(IDR_MYFLOATINGMENU);
        menu.GetSubMenu(0)
            ->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
            point.x, point.y, this);
    }
    You can use ClassWizard to map the floating menu's command IDs the same way you would map the frame menu's command IDs.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章