winform 程序多语言

  1. 新建一个winform程序
  2. 添加资源文件
    winform 程序多语言_第1张图片
  3. 在多语言的资源文件中设置key以及value
  4. 设置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.资源文件名称"

你可能感兴趣的:(C#,c#)