码迷,mamicode.com
首页 > 编程语言 > 详细

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

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

标签:自动   sources   model   控件   inf   global   属性   代码   c#   

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

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#

标签:自动   sources   model   控件   inf   global   属性   代码   c#   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!