private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) 
{
CultureInfo info = null;
if (comboBox1.SelectedIndex == 0)
SetLang("zh-cn", this, this.GetType());
else
SetLang("en-us", this, this.GetType());
}


private void SetLang(string lang, Form form, Type formType)
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lang);
if (form != null)
{
System.ComponentModel.ComponentResourceManager resources = new ComponentResourceManager(formType);
resources.ApplyResources(form, "$this");
AppLang(form, resources);
}
}
private void AppLang(Control control, System.ComponentModel.ComponentResourceManager resources)
{
foreach (Control c in control.Controls)
{
resources.ApplyResources(c, c.Name);
AppLang(c, resources);
}
}

 

posted on 2013-01-06 15:14  Tim_wu  阅读(228)  评论(0)    收藏  举报