您好,此代码一直append text
到textBox
按下键后。它为每次按键写入一行。请问是否有任何好的解决方案来收集例如 5 个按键并将它们写在一行中?
private void User_KeyPress(object sender, KeyPressEventArgs e)
{
textBox.AppendText(string.Format("You Wrote: - {0}\n", e.KeyChar));
textBox.ScrollToCaret();
}
例如 MOUSE 不会写成这样:
You Wrote: M;
You Wrote: O;
You Wrote: U;
You Wrote: S;
You Wrote: E
但输出将是:
You wrote: MOUSE