C#语言切换例程

368 阅读1分钟

\

1. 新建窗体

2. 属性设置

\

3. 设置中文

\

\

注:设置完成后会生成一个配置文件

\

4. 事件设置,双击如图语言进行事件编辑

\

\

5. 代码实现

\

\

\

\

\

\

\

\

\

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Threading;

namespace LanguageStitch
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

            InitializeComponent();
        }

        private void englishToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
            this.Controls.Clear();
            InitializeComponent();
        }

        private void chineseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
            this.Controls.Clear();
            InitializeComponent();
        }
    }
}


\

\

\

\

\

\

\

\

\

\

\