且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何避免在更改语言时显示按下的键?

更新时间:2023-12-03 09:41:40

代替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;
 }