private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == ' ') //判断是否按下Enter键 button1.Focus(); //将鼠标焦点移到"查询"按钮上 }