我正在申请学校,我想在启动画面上使用“按任意键继续”功能。
所以当有人按下某个键时,它会打开下一个表格。 谁能帮我这个?提前谢谢!
到目前为止代码:
//SOME ACTION//
{
Form2 f2 = new Form2();
f2.Show();
this.Hide();
}
答案 0 :(得分:1)
您要查找的内容是表单的KeyPress
事件,因此您可以处理初始屏幕表单的KeyPress
//you need to register the event handle to your form first..
//so the following line could be in your start screen form's constructor
this.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
//then you can open your new form as you suggested
void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
this.Hide();
}