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

VC开发多语言界面支持的简单方法(2)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
配置文件实例: 配置项解释:Section:[Login Dialog]:界面窗口;等号左边:窗口中需要设置其Caption属性的组件ID;等号左边:窗口中需要设置其Caption属性的

配置文件实例:

配置项解释:Section:[Login Dialog]:界面窗口;等号左边:窗口中需要设置其Caption属性的组件ID;等号左边:窗口中需要设置其Caption属性的组件Caption值;

[Login Dialog]

1001 = 用户帐号

1002 = 用户密码

1017 = 登  录

1018 = 退  出

语言包配置信息加载代码:

BOOL CLanguageManager::loadFromFile()
{
    BOOL bRead=FALSE;
    int i;
    ItemContext temp;
    CStringArray itemBuf,valueBuf;
    bRead = fileManager.GetSectionValues("Main Window",itemBuf,valueBuf);
    if(bRead)
    {
        for(i=0;i<itemBuf.GetSize();i++)
        {
            temp.uCtrlID = atoi(itemBuf.GetAt(i));
            temp.strContext = valueBuf.GetAt(i);
            m_vtContexts.push_back(temp);
        }
    }
    itemBuf.RemoveAll();
    valueBuf.RemoveAll();
   
    bRead = fileManager.GetSectionValues("Login Dialog",itemBuf,valueBuf);
    if(bRead)
    {
        for(i=0;i<itemBuf.GetSize();i++)
        {
            temp.uCtrlID = atoi(itemBuf.GetAt(i));
            temp.strContext = valueBuf.GetAt(i);
            m_vtContexts.push_back(temp);
        }
    }
    return bRead;
}

精彩图集

赞助商链接