C#语言切换例程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ALONE_WORK/article/details/70144712

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();
        }
    }
}












展开阅读全文

没有更多推荐了,返回首页