-9

我正在申请学校,我想在启动屏幕上使用“按任意键继续”功能。

因此,当有人按下一个键时,它会打开下一个表单。谁能帮我这个?提前致谢!

到目前为止的代码:

//SOME ACTION//
   {
     Form2 f2 = new Form2();
     f2.Show();
     this.Hide();
   }
4

1 回答 1

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();
 }
于 2013-10-07T10:53:10.357 回答