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

namespace Ex07_6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            foreach (InputLanguage ilanguage in InputLanguage.InstalledInputLanguages)
            {
                comboBox1.Items.Add(ilanguage.LayoutName);    //动态添加系统输入法
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            InputLanguage currentLanguage = InputLanguage.InstalledInputLanguages[comboBox1.SelectedIndex];
            InputLanguage.CurrentInputLanguage = currentLanguage;
            MessageBox.Show("系统输入法设置成功！", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
            Application.Exit();
        }
    }
}
