向菜单项添加子菜单项
Adding submenu items to menuitems
我在c++中为窗口菜单添加子菜单项时遇到了麻烦。我正在为我的游戏添加一个数字(准确地说是20)来保存插槽。
下面是我保存槽的代码:
HMENU win32MENU = CreateMenu();//Menu bar
HMENU win32SETTINGS = CreateMenu();//Settings option
HMENU win32SAVESLOTS = CreateMenu();//Save Slots
AppendMenu(win32MENU,MF_POPUP,(UINT_PTR)win32SETTINGS,"Settings");
//Settings
AppendMenu(win32SETTINGS,MF_STRING,(UINT_PTR)win32SAVESLOTS,"Save Ctrl+S");
//Save Slots
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Default ~");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 1");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 2");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 3");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 4");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 5");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 6");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 7");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 8");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 9");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 10");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 11");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 12");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 13");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 14");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 15");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 16");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 17");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 18");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 19");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 20");
变化:
AppendMenu(win32SETTINGS,MF_STRING,(UINT_PTR)win32SAVESLOTS,"Save Ctrl+S");
AppendMenu(win32SETTINGS,MF_STRING | MF_POPUP,(UINT_PTR)win32SAVESLOTS,"Save Ctrl+S");
同样,修改
HMENU win32SAVESLOTS = CreateMenu();//Save Slots
HMENU win32SAVESLOTS = CreatePopupMenu();//Save Slots
相关文章:
- 难以从 CImageList 设置菜单项位图
- 连接资源文件中的字符串,并将其传递给菜单项字符串 (winapi) c++
- 获取 c++ mfc vs2015 中弹出资源菜单项的 id
- 将项添加到矢量而不创建临时对象
- 无法在 cocos2dx 中显示菜单菜单项图像
- 如何在 C++ 中的资源脚本中将项添加到组合框
- C++ |无法将项添加到类成员向量
- 带有回调函数的cocos2d-x菜单项错误
- 将依赖项添加到现有共享对象库
- 如何安全地将包含的对象(菜单项)与需要容器(菜单)的API同步
- 使用WXWIDGET C 将菜单和子菜单选项添加到Mac中的窗口菜单
- QT在菜单项上显示模态对话框(.UI)单击
- 将菜单项添加到Windows Explorer右键单击Java中的上下文菜单
- 如何在Qt中再次将菜单项变灰
- 如何在 c++ win32 API 中向菜单项添加图标
- gtkmm3中的菜单项始终处于禁用状态
- 在cocos2dx中创建菜单项标签时断言失败
- winapi-如何在MFC中以编程方式将多个菜单栏添加到一个框架中
- MFC正在将项添加到系统菜单
- 向菜单项添加子菜单项