首页 新闻 会员 周边

求详细完整的代码:Winforms 窗体实现中英文切换

0
悬赏园豆:40 [已解决问题] 解决于 2015-09-28 15:27

要求:选择下拉列表中的语言,切换到相应的语言文字,窗体中包含一些lable,button,groupbox等控件,用XML文件作为资源文件来存中文和英文的控件Text;

绑定下拉框的XML文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<AppConfig>
<Area>
<Language>ZH</Language>
<List>
<Item>中文[ZH]</Item>
<Item>英文[EN]</Item>
</List>
</Area>
<Area>
<Language>EN</Language>
<List>
<Item>Chinese[ZH]</Item>
<Item>English[EN]</Item>
</List>
</Area>
</AppConfig>

 

存储中文的XML文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<Resource>
<Form>
<Name>frmMain</Name>
<Controls>
<Control name="frmMain" text="SysConfigTool_Single" />
<Control name="btnFactoryReset" text="出厂重置" />
<Control name="btnReload" text="重新加载" />
<Control name="btnSaveSet" text="保存设置" />
</Controls>
</Form>
<Form>
<Name>frmSystemSet</Name>
<Controls>
<Control name="lblLoginHospitalName" text="登录界面医院名称:" />
<Control name="gbReportSet" text="报告单相关设置" />
<Control name="lblReportHospitalName" text="报告单医院名称:" />
<Control name="lblReportCheckRise" text="报告单检查抬头:" />
<Control name="lblRemark" text="(报告单抬头=报告单医院名称+报告单检查抬头。全长不超过30个汉字)" />
<Control name="gbLogSet" text="日志详细程度设置" />
</Controls>
</Form>
<Form>
<Name>frmLoging</Name>
<Controls>
<Control name="label1" text="CardioNet软件配置工具" />
<Control name="lblUserName" text="用户名:" />
<Control name="lblPwd" text="密码:" />
<Control name="btnLogin" text="登录" />
<Control name="btnCancel" text="取消" />
</Controls>
</Form>
</Resource>

 

英文同上,只是Text不同

求大神指导!!感激不尽!!

哈哈练的主页 哈哈练 | 初学一级 | 园豆:113
提问于:2015-08-28 15:06
< >
分享
最佳答案
0

切换的时候,为控件的text重新赋值呗,中文的时候 lbl.text="中文",切换的时候lbl.text="English";

收获园豆:20
wolfy | 老鸟四级 |园豆:2636 | 2015-08-30 11:47

要代码,谢谢~

哈哈练 | 园豆:113 (初学一级) | 2015-09-01 14:51
其他回答(1)
0

保存数据的时候就用 json格式保存{cn:"",en:""}

收获园豆:20
唯我独萌 | 园豆:537 (小虾三级) | 2015-08-31 15:23

请看标题:要代码,非诚勿扰!!

支持(0) 反对(0) 哈哈练 | 园豆:113 (初学一级) | 2015-09-01 14:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册