龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC中多语言菜单的实现[图](2)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
三、在 CMainFrame中加入变量CMenu m_englistmenu 和m_chinesemenu保存中英文菜单资源 加入变量enum Enum{e,c}m_current 保存当前菜单 四、由于默认为中文菜单在 CMainFram

  三、在 CMainFrame中加入变量CMenu m_englistmenu 和m_chinesemenu保存中英文菜单资源

  加入变量enum Enum{e,c}m_current 保存当前菜单

  四、由于默认为中文菜单在 CMainFrame::CMainFrame()中设置m_current=c;表示当前为中文菜单,在CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)中装入英文菜单资源 m_englistmenu.LoadMenu("IDR_MAINFRAME_ENGLISH");
HMENU m_hMenu=::GetMenu(this->m_hWnd); // 保存中文菜单---www.bianceng.cn
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;
  }
  
}编译运行程序您就可以获得一个具有英汉对照菜单的应用程序。

精彩图集

赞助商链接