如何使MenuItem不活动

时间:2014-03-29 13:45:39

标签: c++ gdi

现在我已经编辑了MenuItem ...我已经创建了它但是我需要让这些选项不活动才能不被无理地按下

HMENU hMenu, hSubMenu;

            hMenu = CreateMenu();

            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, ID_DDA, "DDA");
            AppendMenu(hSubMenu, MF_STRING, ID_MID, "Mid-Point");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hSubMenu, "Algorithm");

            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, ID_UNDO, "Undo");
            AppendMenu(hSubMenu, MF_STRING, ID_REDO, "Redo");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hSubMenu, "Edit");

            SetMenu(hwnd, hMenu);

是否有一个标志或函数要调用,以根据子菜单项的用法设置子菜单项是活动还是非活动?

1 个答案:

答案 0 :(得分:1)

您可以包含MF_GRAYED标志以禁用菜单项。