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

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

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
str=strline.Right(strline.GetLength()-strline.Find("=")-1);//去掉=左边 str.TrimLeft(); str.TrimRight(); //保存等号右边项 strValueBuf.Add(str); bRead = TRUE; } //当前Section遍历结束 }

                    str=strline.Right(strline.GetLength()-strline.Find("=")-1);//去掉=左边
                    str.TrimLeft();
                    str.TrimRight();
                    //保存等号右边项
                    strValueBuf.Add(str);
                    bRead = TRUE;
                }
                //当前Section遍历结束
            }
            //没有找到Section
        }
        //当前行遍历结束
    }
    return bRead;
}
 

修改指定组件Caption属性代码:


BOOL CLanguageManager::setControlCaption(CWnd * pCtrl, UINT ctrlID)
{
    BOOL isOK=FALSE;
    for(int i=0;i<m_vtContexts.size();i++)
    {
        isOK = (m_vtContexts[i].uCtrlID==ctrlID);
        if(isOK)
        {
            pCtrl->SetWindowText(m_vtContexts[i].strContext);
            break;
        }
    }
    return isOK;
}
 

遍历设置指定窗口所有组件Caption属性代码:

 void CLanguageManager::setCaptionForWindow(CWnd * pWnd)
{
    char *buf = new char[512];
    //枚举对话框中所有组件
    pWnd->SetWindowText("JKLJKL");
    UINT ctrlID = pWnd->GetDlgCtrlID();
    setControlCaption(pWnd,ctrlID);
   
    CWnd *pCtrl = pWnd->GetWindow(GW_CHILD);
    while(pCtrl!=NULL)
    {
        ctrlID = pCtrl->GetDlgCtrlID();
        setControlCaption(pCtrl,ctrlID);
        pCtrl = pCtrl->GetNextWindow();
    }
}

收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!
按钮 内容不能为空!
立刻说两句吧! 查看0条评论
精彩图集

赞助商链接