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 WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void textBox1_Enter(object sender, EventArgs e) { SetKeyboardLayout(GetInputLanguageByName("mal")); } private void textBox1_Leave(object sender, EventArgs e) { SetKeyboardLayout(GetInputLanguageByName("eng")); } public static InputLanguage GetInputLanguageByName(string inputName) { foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages) { if (lang.Culture.EnglishName.ToLower().StartsWith(inputName)) return lang; } return null; } public void SetKeyboardLayout(InputLanguage layout) { InputLanguage.CurrentInputLanguage = layout; } } }
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CreateSpecificCulture("en-GB");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)