- 新建一个winform程序
- 添加资源文件
- 在多语言的资源文件中设置key以及value
- 设置button根据环境选择语言文件
namespace WindowsFormsMulLang
{public partial class Form1 : Form{public Form1(){InitializeComponent();}public static ResourceManager rm = new ResourceManager("WindowsFormsMulLang.Properties.chinese", Assembly.GetExecutingAssembly());private void Form1_Load(object sender, EventArgs e){button1.Text = rm.GetString("button1");}}
}
注意
ResourceManager第一个参数是"工程名称.Properties.资源文件名称"