如何避免在更改语言时显示按下的键? [英] How to avoid displaying the key pressed when changing the language?
问题描述
我有一个Windows应用程序,可以用我们选择的任何语言(如印地语,阿拉伯语等)提供输入.
我的问题是在文本框中键入内容时,首先显示我键入的键,然后立即将其转换为我之前选择的语言..
我的要求是在转换成另一种语言之前,不要查看按下的键.
这是使用Pre-Render()事件在类似的Web应用程序中完成的.
但是不知道在Windows应用程序中...有什么建议..
以下是我的代码:
Hi,
I''ve a windows application in which the input can be given in any language we select like hindi, Arabic etc..
My problem is while typing in textbox, at first the key which I type is displayed and immediately it is converted into the language I selected previously..
My requirement is not to view the key I pressed before converting into another language.
This is done in Similar Web application using Pre-Render() event..
But do not know in windows app... any suggestion plz..
Below is my code:
private void txtSchoolName_KeyUp(object sender, KeyEventArgs e)
{
string str;
Class2 cls = new Class2();
if (_lang == "te") //te-Telugu language
{
str = cls.TeluguText(txtSchoolName.Text);
txtSchoolName.Text = str;
txtSchoolName.SelectionStart = txtSchoolName.Text.Length;
}
预先感谢,
Ravi kamesh ..
Thanks in advance,
Ravi kamesh..
推荐答案
代替KeyUp(),请使用KeyPress()事件来捕获您的键盘按键.然后设置e.Handled = true:
Instead of KeyUp(), use KeyPress() event to capture your keyboard presses. Then set e.Handled = true:
private void txtSchoolName_KeyPress(object sender, KeyEventArgs e)
{
string str;
Class2 cls = new Class2();
if (_lang == "te") //te-Telugu language
{
e.Handled = true;
str = cls.TeluguText(txtSchoolName.Text);
txtSchoolName.Text = str;
txtSchoolName.SelectionStart = txtSchoolName.Text.Length;
}
这篇关于如何避免在更改语言时显示按下的键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!