Programming with Microsoft Visual C++.NET 6ed [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Programming with Microsoft Visual C++.NET 6ed [Electronic resources] - نسخه متنی

George Shepherd, David Kruglinski

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید








Creating Floating Shortcut Menus


Floating shortcut menus are one of the latest trends in user interface design. The user clicks the right mouse button and a floating menu offers commands that relate to the current selection. It's easy to create these menus using the resource editor and the MFC library CMenu::TrackPopupMenu function. Just follow these steps:



  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 command, and then add commands in the resulting shortcut menu.



  3. Use Class View's Properties window 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 here:

     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 Class View's Properties window to map the floating menu's command IDs in the same way you would map the frame menu's command IDs.




/ 319