C# - 隐藏当前表单并在按下某个键时显示另一个表单

时间:2016-05-02 22:31:55

标签: c#

如何制作它以便隐藏当前表单并在按下某个键时显示另一个表单?那是我现在的代码

 private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
           if (e.KeyCode == Keys.Escape) { this.Close(); } //press escape to quit
           if (e.KeyCode == Keys.Enter)     //reload game
            {

1 个答案:

答案 0 :(得分:0)

你在搜索这条线路吗?

    private void Form1_KeyDown(object sender, KeyEventArgs e)
    {
       if (e.KeyCode == Keys.Escape) { 
           this.Close(); // Closing the initial form will close the application
       } //press escape to quit
       if (e.KeyCode == Keys.Enter)     //reload game
       {
           Form1 f2 = new Form1();
           f2.Show();
       }
    }