版权声明:随便看,喜欢的话加我qq,一起讨论。 https://blog.csdn.net/qq_43687284/article/details/84297083
//按回车等同于按“Tab”
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar == (char)13)
{
SendKeys.Send("{Tab}");
}
}
//按回车等同于点击按钮
if (e.KeyChar.Equals('\r'))
{
button1.PerformClick();
}