private void SetControlLanguage(Control ctrl, bool bHebrew) { if (bHebrew) { ctrl.RightToLeft = System.Windows.Forms.RightToLeft.Yes; ActiveLayout.Hebrew(); } else { ctrl.RightToLeft = System.Windows.Forms.RightToLeft.No; ActiveLayout.English(); } ctrl.Focus(); }
static public int SwitchTo(uint LayoutID) // 0x409 for ENG { if (ActiveLayout.GetKeyboardLayout() != LayoutID) // If not english ( 0x409 ) - switch { bool Found = false; foreach (InputLanguage c in InputLanguage.InstalledInputLanguages) { if (c.Culture.LCID != LayoutID) { continue; } Found = true; } if (!Found) { AttemptNo = 0; return(-2); } if (AttemptNo > InputLanguage.InstalledInputLanguages.Count) { AttemptNo = 0; return(-1); } String HexString = LayoutID.ToString("X"); HexString = "00000000".Substring(HexString.Length) + HexString; ActiveLayout.SetKeyboardLayout(HexString); // Console.WriteLine(HexString); AttemptNo++; } else { AttemptNo = 0; return(1); } return(0); // Sent request, result not known yet }