首页 > 编程语言 > 详细

为程序设置多语言界面——C#

时间:2017-02-04 17:59:26      阅读:165      评论:0      收藏:0      [点我收藏+]

考虑到程序的国际化需求,需要为程序设置多语言界面。

1,新建一个资源文件,名字可以是对应界面+语言代码(MainForm.zh-CN)。这样资源文件就会自动添加到对应界面下面。

技术分享

2,更改界面属性Localizable为Ture

技术分享

3,调用相关的资源文件,为相关控件赋值

技术分享

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(language);
if (form != null)
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(formType);
resources.ApplyResources(form, "MainForm");
//AppLang(form, resources);
}

 

为程序设置多语言界面——C#

原文:http://www.cnblogs.com/xuganhua2012/p/6365751.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!