文本框C#应用程序中的印地语输入 [英] Hindi Input in textbox c# application
问题描述
它们是在c#应用程序的文本框中获取印地语输入的任何方式. 我只是尝试一个简单的 我是C#和stackoverflow社区的新手.所以让我知道我在问问题时是否错过了某事
Is their any way to get Hindi input in a textbox in a c# application . I am just trying a simple I am bit new to C# and stackoverflow community . SO let me know if i have missed something while asking question
推荐答案
最后,我得到了答案,并将其发布以供您发表评论,评论和帮助谁. 我刚刚添加了一个复选框,下面是代码.
Finally i got a answer for it and posting it for Your comment , reviews and help who needs same. I just added a checkbox and below is the code .
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
textBox1.Font = new Font("Mangal", 10);
textBox2.Font = new Font("Mangal", 10);
ToHindiInput();
}
else
{
textBox1.Font = new Font("Times New Roman", 10);
textBox2.Font = new Font("Times New Roman", 10);
ToEnglishInput();
}
}
public void ToEnglishInput()
{
string CName = "";
foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
{
CName = lang.Culture.EnglishName.ToString();
if (CName.StartsWith("English"))
{
InputLanguage.CurrentInputLanguage = lang;
}
}
}
public void ToHindiInput()
{
string CName = "";
foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
{
CName = lang.Culture.EnglishName.ToString();
if (CName.StartsWith("Hindi"))
{
InputLanguage.CurrentInputLanguage = lang;
}
}
}
要使InputLanguage正常工作,您需要在Machine中安装该语言. 可以通过转到区域和语言设置->第3个标签并安装印地语"来完成.
For InputLanguage to work You need to have that language installed in Your Machine . Can be done by going to Region and language setting -> 3rd tab and install Hindi language .
注意:
1.您用于其他任务的键盘布局也会更改
因此,不要忘记在表单关闭时调用ToEnglishInput().
Note:
1. Your Keyboard layout will for other task also change
So don't forget to call ToEnglishInput() on closing of the form .
2.如果您觉得难以输入,也可以使用屏幕键盘进行输入. 3.可以针对多种语言实施相同的方法.
2.Also You can use OnScreen keyboard to input if You feel it difficult to input. 3. The same approach can be implemented to for multiple languages.
请给您满意的答案,请投票. 总是欢迎提出建议. 编码愉快. :-)
Plz Vote Up if you find answer satifactory . Suggestion are always welcome. Happy Coding. :-)
这篇关于文本框C#应用程序中的印地语输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!