2008年(909)
分类:
2008-05-06 21:34:18
IDR_MAINFRAME MENU PRELOAD DISCARDABLE BEGIN POPUP "文件(&F)" BEGIN MENUITEM "新建(&N)\tCtrl N", ID_FILE_NEW MENUITEM "打开(&O)...\tCtrl O", ID_FILE_OPEN MENUITEM "保存(&S)\tCtrl S", ID_FILE_SAVE MENUITEM "另存为(&A)...", ID_FILE_SAVE_AS MENUITEM SEPARATOR MENUITEM "打印(&P)...\tCtrl P", ID_FILE_PRINT MENUITEM "打印预览(&V)", ID_FILE_PRINT_PREVIEW MENUITEM "打印设置(&R)...", ID_FILE_PRINT_SETUP MENUITEM SEPARATOR MENUITEM "最近文件", ID_FILE_MRU_FILE1, GRAYED MENUITEM SEPARATOR MENUITEM "退出(&X)", ID_APP_EXIT END POPUP "编辑(&E)" BEGIN MENUITEM "撤消(&U)\tCtrl Z", ID_EDIT_UNDO MENUITEM SEPARATOR MENUITEM "剪切(&T)\tCtrl X", ID_EDIT_CUT MENUITEM "复制(&C)\tCtrl C", ID_EDIT_COPY MENUITEM "粘贴(&P)\tCtrl V", ID_EDIT_PASTE END POPUP "查看(&V)" BEGIN MENUITEM "工具栏(&T)", ID_VIEW_TOOLBAR MENUITEM "状态栏(&S)", ID_VIEW_STATUS_BAR MENUITEM "弹出CD", ID_VIEW_FULLSCREEN MENUITEM "英文", ID_MENU_CHANGE END POPUP "帮助(&H)" BEGIN MENUITEM "关于 FullScreen(&A)...", ID_APP_ABOUT END END在此后加入英文菜单资源复制上述文本,把其中的中文改成英文,并作些改动
IDR_MAINFRAME_ENGLISH MENU PRELOAD DISCARDABLE BEGIN POPUP "File(&F)" BEGIN MENUITEM "New(&N)\tCtrl N", ID_FILE_NEW MENUITEM "Open(&O)...\tCtrl O", ID_FILE_OPEN MENUITEM "Save(&S)\tCtrl S", ID_FILE_SAVE MENUITEM "Save as(&A)...", ID_FILE_SAVE_AS MENUITEM SEPARATOR MENUITEM "Print(&P)...\tCtrl P", ID_FILE_PRINT MENUITEM "Print Preview(&V)", ID_FILE_PRINT_PREVIEW MENUITEM "Print Setting(&R)...", ID_FILE_PRINT_SETUP MENUITEM SEPARATOR MENUITEM "Recent Files", ID_FILE_MRU_FILE1, GRAYED MENUITEM SEPARATOR MENUITEM "Exit(&X)", ID_APP_EXIT END POPUP "Edit(&E)" BEGIN MENUITEM "Undo(&U)\tCtrl Z", ID_EDIT_UNDO MENUITEM SEPARATOR MENUITEM "Cut(&T)\tCtrl X", ID_EDIT_CUT MENUITEM "Copy(&C)\tCtrl C", ID_EDIT_COPY MENUITEM "Paste(&P)\tCtrl V", ID_EDIT_PASTE END POPUP "View(&V)" BEGIN MENUITEM "ToolBar(&T)", ID_VIEW_TOOLBAR MENUITEM "StatusBar(&S)", ID_VIEW_STATUS_BAR MENUITEM "Eject CD", ID_VIEW_FULLSCREEN MENUITEM "Chinese", ID_MENU_CHANGE END POPUP "Help(&H)" BEGIN MENUITEM "About FullScreen(&A)...", ID_APP_ABOUT END END修改完成后保存资源。
m_englistmenu.LoadMenu("IDR_MAINFRAME_ENGLISH"); HMENU m_hMenu=::GetMenu(this->m_hWnd); // 保存中文菜单 m_chinesemenu.Attach(m_hMenu);五、加入菜单函数
void CMainFrame::OnMenuChange() { if(m_current==e) { SetMenu(&m_chinesemenu); m_current=c; } else { SetMenu(&m_englistmenu); m_current=e; } }编译运行程序您就可以获得一个具有英汉对照菜单的应用程序。 下载本文示例代码