Formda birkaç Metin kutusu var. Sadece Farsçalardan birinde yazmak istiyorum. Bu kodu buldum, ancak ilk karakter ingilizce yazılmıştır.Metin kutularından birinde yalnızca Fars dilinde nasıl yazılır
private void txtBox_Enter(object sender, EventArgs e)
{
YourMethod();
}
private InputLanguage GetFarsiLanguage()
{
//Enumerate through InstalledInputLanguages which contains
//all the keyboard layout you’ve installed in your windows.
foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
{
if (lang.LayoutName.ToLower() == "farsi" || lang.LayoutName.ToLower() == "persian")
return lang;
}
return null;
}
public void YourMethod()
{
InputLanguage lang = GetFarsiLanguage();
if (lang == null)
throw new NotSupportedException("Farsi Language keyboard is not installed.");
//Set the current language of the system to
//the InputLanguage instance you need.
InputLanguage.CurrentInputLanguage = lang;
}
private void txtBox_TextChanged(object sender, EventArgs e)
{
YourMethod();
}