在设计系统时,我们经常要碰到多语言的问题,这里是我经过几个小时研究出来的结果,希望对大家有用:
1,新建资源文件:
如:string.zh-cn.resx;string.en-su.resx...
2.如何取得资源文件中的字符.
引用接口 using System.Resources;
定义对象(构造对象):private ResourceManager m_ResourceManager= new ResourceManager("WindowsApplication1.string",System.Reflection.Assembly.GetExecutingAssembly());
取得资源文件中的字符:
private ResourceManager textBox1.Text =m_ResourceManager.GetString("good",System.Globalization.CultureInfo.CurrentCulture );
good表示你要取字符的值.
3.但我们可能在中途可以要改变字符的语种,我们可以用以下的语句
先要引用接口:using System.Threading; Thread.CurrentThread.CurrentCulture=new CultureInfo( "en-us", false );
刚学C#不久,希望有机会能同大家交流!