【发布时间】:2023-04-07 04:06:01
【问题描述】:
我需要做类似的东西 http://www.codeproject.com/Articles/301832/Custom-Text-box-Control-that-Switch-keyboard-langu 但对于 WPF 和 C#
我试图用一个简单的 if 语句来做到这一点,但我不得不放另一个这样的文本框
private void textBox2_TextChanged(object sender, TextChangedEventArgs e)
{
textBox1.Focus();
if (textBox1.Text == "Q" || textBox1.Text == "q")
{
textBox2.Text = textBox2.Text+ "ض";
textBox1.Text = "";
}
else if (textBox1.Text == "W" || textBox1.Text == "w")
{
textBox2.Text = textBox2.Text + "ص";
textBox1.Text = "";
}
// and so ..
}
它有效,但我想做类似上面链接的事情
【问题讨论】:
-
该链接不是为您提供了源代码以及对正在发生的事情及其工作原理的解释吗?似乎最好的方法是研究您链接到的完整解决方案,在适当的地方进行编辑,并在遇到特定问题时提出问题。